CodeIgniter Forums

Full Version: [FIX included] Firefox 3.0.3 PDF upload problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]janogarcia[/eluser]
Firefox 3.0.3 is setting the pdf type as "application/download" in the $_FILES array. CodeIgniter will fail to validate it against the pdf array specified in application/config/mimes.php

Code:
'pdf'    =>    array('application/pdf', 'application/x-download')

Change it to this if you are experiencing problems

Code:
'pdf'    =>    array('application/pdf', 'application/x-download', 'application/download')

El Forum

[eluser]Bogdan Tanase[/eluser]
Yeah, that is indeed a problem. It appears that each browser with each release sends a different MIME type. And not just for pdfs... Sad

El Forum

[eluser]JoostV[/eluser]
Firefox 3 also sets the Mimetype for some Word documents to a string that is not in config/mimes.php. Codeigniter will fail to validate those Word documents.
Code:
'doc'    =>    'application/msword'
Fix: change this to
Code:
'doc'    =>    array('application/msword', 'application/vnd.ms-word')

Frustrating, this is. I'll have to upload an update mimes.php into all codeigniter sites now...

El Forum

[eluser]hugle[/eluser]
Thanks for the tips guys.

El Forum

[eluser]Unknown[/eluser]
It gets ever better...

When uploading a CSV file, I found that Firefox 3.0.5 reports the MIME-type as \"x-comma-separated-values\" (with the \ and "included!!!!) instead of x-comma-separated-values

and Explorer 7 reports it as text/plain

Grrmbbbllll....

El Forum

[eluser]Unknown[/eluser]
i have the same problem. but i fix it by editing the mimes.php

Code:
'pdf' => array('application/pdf', 'application/download', '\"application/force-download\"', 'application/force-download', '\"application/download\"', 'application/x-download', '\"application/x-download\"', '\"application/pdf\"'),

after that i able to upload the pdf files.

El Forum

[eluser]Bogdan Tanase[/eluser]
I think we all know hot to fix it, but unfortunetly with each new browser version a new mimetype appears... It's pretty annoying.

Maybe the upload class needs a revision and make the mimetype validation optional.

El Forum

[eluser]Unknown[/eluser]
I use Firefox 3.5.3 It's can't to see the file type when I uploaded .pdf T_T

El Forum

[eluser]Unknown[/eluser]
FF 3.0.14 sets the MIME of PDF files as 'application/doc' which is pretty annoying.

Optional mimetype validation seems a good idea. Maybe in CI 1.7.3? Wink

El Forum

[eluser]Unknown[/eluser]
This behaviour (for me, I got "application/x-pdf" instead of "application/pdf") doesn't seem to be a problem of Firefox using different MIME types with each new release but is obviously due to a bug which corrupts the mimeTypes.rdf: https://bugzilla.mozilla.org/show_bug.cgi?id=332690

Unfortunately this bug from 2006(!) is still not fixed.
Pages: 1 2