Wednesday, August 31, 2005
Sunday, August 28, 2005
My book collection
Thursday, August 18, 2005
Saturday, August 13, 2005
Monday, August 08, 2005
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. :-(
Wednesday, August 03, 2005
With over 10% usage share, Mozilla is now a quite profitable business. Mozilla Corporation, a subsidiary wholly owned by Mozilla Foundation, is just created today with the aim to gather cash for supporting the wonderful Mozilla project (well, according to my understanding).
Who know what will happen next year. ;-)
P.S. I've just created its entry in Wikipedia. Help fixing and improving it if you can. :-)