Firefox (for Windows)-specific file upload problem
I was writing a simple PHP script for handling file upload. I found that some files that I uploaded with Firefox are 0 bytes in size (it should be non-zero). Since I developed it under a Chinese (simpified) Windows, I found this problem rather ridicious: I can't upload a file named with certain simpified Chinese characters!
Let's illustrate with the following example:
- Create a dummy file with dummy content.
- Rename it so that it contains the character
- Upload them using a HTML form (encoded in UTF-8).
The result in PHP (by using print_r $_FILES;):
Array ( [attachment] => Array ( [name] => Array (  => print.pdf  => 高_seed.pdf  =>  =>  => ) [type] => Array (  => application/pdf  => application/octet-stream ) [tmp_name] => Array (  => C:\WINDOWS\TEMP\php17F.tmp  => C:\WINDOWS\TEMP\php180.tmp ) [error] => Array (  => 0  => 0 ) [size] => Array (  => 31527  => 0 ) ) )
See? The character
达 was replaced with a underscore
_, and the file size is zero. The file upload was success since the error codes are 0s.
Obviously Firefox can't find the file (can't resolved the path?), so it uploads nothing to the server. I guess it is another time to file a bug in the famous bugzilla database. ;-)
Edited: it seems that the bug was already filed by someone else.
Edited again: anyway, I filed the bug, although it seems that no one noticed yet. :-(