If you're still stumped with it, I found this in the PHP manual:
$_FILES['userfile']['name'] = The original name of the file on the client machine where 'userfile' is the name of the form field.
So you could change the $insertSQL = sprintf(... line to include that...
It does depend on which version of PHP you've got as the $_FILES variable is relatively new - you might have to use $
ST_VARS as your file already does.
Hope this helps