Wednesday, July 22, 2009

Internet Explorer SUCKS

I've just finished my project, it had multi file upload feature. And there were some problems.

First I used muti file upload from Fyneworks.
It's good.

The trouble came when I validate mime type of uploaded-file.
First I collected a list of mime type, you can search it from internet. And below is the list mime type that I used to validate uploaded-file:

$allow_file = array('gif','jpg','png','doc','docx','rar','zip','wma','mp3','pdf');
$allow_mime = array(
'image/gif', 'image/jpeg', 'image/png',
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/x-rar-compressed', 'application/zip',
'application/octet-stream','application/force-download','image/pjpeg', //fix for suck mime of ie *_*
'audio/mpeg', 'audio/x-ms-wma',

zip application/zip
doc application/msword
docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
jpeg image/jpeg
jpg image/jpeg
doc application/msword
mp3 audio/mpeg3
rar application/x-rar-compressed

When validate in client by javascript, it's ok.
But when validate by php, the trouble come!!!
In Firefox the mime type of uploaded-file is true.
But when i use Internet Explorer v6 to submit file, some file is missing.
What's the f*ck!ng ???
I've used the print_r to debug, it's really good at this instance.

Let's see:
In Firefox : All mime type are right!!!
rar => application/x-rar-compressed
zip => application/zip
jpeg => image/jpeg
But in Internet Explorer:
rar => application/force-download
zip => application/octet-stream
jpeg => image/pjpeg
I have not tested all the mime type, but now I know the reason of missing file.

No comments:

Post a Comment