I'm not that familiar with Pure PHP v3... Do you have Data Bridge, our upload server behavior has solutions to these two problems built in....
If you have to use Pure PHP v3, then you will have to check their documentation on how to refer to the actual uploaded file name on the server vs the name it was uploaded with. They would have had to have built something into the code to return that value that you can use in the update.
If it is anything like ours, that value will return the original file name when no file has been uploaded so that it won't overwrite with a blank value either.
If you have to do it manually, then you can add a hidden field to the form with the old file name before upload, and use an if statement to see if there is a new file name and if not set the value to the old one... actually there is an option in our MySQLi update for what to do with a blank value.. if you set that to "ignore" then it wouldn't overwrite with a blank value on update automatically.