Entry
Binary files get couupted when uploaded with a php script - even if content-type is specified. Why?
Apr 2nd, 2008 23:44
dman, Justin Dalrymple, kara _, http://www.ttnr.org
You are probably using PHP4.0.4pl1, uploading to a Mac-based server,
most-likely Yellow Dog Linux.
The content-type is prepended to the uploaded file. To ASCII files,
this does not present a problem [other than printing the content-type
when the file is viewed], but to BINARY files; it simply corrupts the
file.
If you open the binary file uploaded using a TXT viewer, you will
notice the content-type on the very first line of the file.
If you run PHP on your local machine, you should upgrade PHP to version
4.1.2.
If you are accessing PHP remotely, from your web host; Your best bet is
to encourage your web host to upgrade to PHP4.1.2, which is the latest
RPM available for YellowDog Linux.