Welcome Guest, Not a member yet? Register   Sign In
[FIX included] Firefox 3.0.3 PDF upload problem
#1

[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')
#2

[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
#3

[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...
#4

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

[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....
#6

[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.
#7

[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.
#8

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

[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
#10

[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.




Theme © iAndrew 2016 - Forum software by © MyBB