File upload using Mozilla Firefox can fail when the filename contains international characters
When uploading a file that has international characters using Mozilla Firefox, the uploaded file may have an altered name (for example, underscore instead of some characters) with a file size of 0.
I understand this to be related to the way Mozilla handles fileupload in their browsers as I don’t have a problem getting the file uploaded with IE. Having searched the Internet for a solution I came up empty-handed. I did however come across some php code that is essentially the way I am using this snippet as well. But alas they got it wrong as well, their code doesn’t include a check for file-size = 0 allowing the file to be uploaded without any actual data.
Any one found a solution to this before and care to share. Thanks.
SB
Somehow I missed this post.
If you can provide me with a file that causes problems I can have a look at it.
Thanks for getting back to me on this Mitch. The file that causes problems is just a mock-up zip archive with a fictitious name to include international characters. The error message (size is 0 bytes) reported by the FileUpload snippet is: ’sangirdamak.zip is invalid.’ This is as a result of the file having an altered name with a file size of 0.
Commenting out lines 195 - 199 (checking for file-size = 0) will allow for an empty file with altered name being created in the upload folder. But that is no good of course. The original file name is ’şanğırdamak.zip’ and is 89 bytes. I have attached it to this post.
I was able reproduce the problem by renaming a file to "şanğırdamak.zip" (copy/pasted the name from the forums).
The strange thing is that when you press the "Browse..." button and select the file everything seems to be OK, but when you press "Open" the name that is displayed in the editbox will be "sangirdamak.zip". This might be causing the problem.
I hope to have some time later this week to have a look at this.
Is there a way to restrict what characters are allowed in the uploadable file name?
Like if I wanted to only allow files with numbers and letters in their name, no special characters
Or wanted to disallow files with certain characters in them?