in reply to Binary File Upload

... is there any thing wrong with my code that I've missed?

You're not checking if the open UPLOADFILE, ... succeeded.  Even if the "500" error you're getting should not be immediately related, this is always a good idea to do...