Mimetype output wrong on upload via php($_FILES -file_type) with FF




14 years ago
9 years ago


(Reporter: webmaster, Unassigned)


1.5.0.x Branch
Windows XP

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [CLOSEME 5-15-2010])



14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv: Gecko/20060111 Firefox/
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv: Gecko/20060111 Firefox/

I have restricted uploads to *.pdf,*.zip,*.rar in a simple php upload-function.
With FF (german) i can´t upload pdf + zipfiles because my script checks for the correct mimetype. Firefox give wrong mimetypes for zip and pdf !
The results are from the global php var $_FILES['upload']['upload_type'].

Reproducible: Always

Steps to Reproduce:
1.Try to upload a pdf or zipfile with a simple php upload script
2.Display the contents of $_FILES with ' print_r($_FILES); '
3.The output shows you under [type] => the mimetype.

Actual Results:  
If a pdf is uploadfile, 'application/octetstream' is returned 
If upload is a zipfile, FF returned 'application/force-download'.

Expected Results:  
Pdf´s should return 'application/pdf'.
Zipfiles should return 'application/x-zip-compressed' or 'application/zip'.

Internet Explorer returns- zip: application/x-zip-compressed, pdf: application/pdf
Opera returns- zip: application/zip, pdf: application/pdf

These are the correct and expected mimetypes.
Dupe of/related to bug 316143 and/or bug 279619?

Comment 2

14 years ago
Yeah, a bit related to bug 316143, adds wrong zip mimetype.
Additional: With FF 1.07 all uploads went fine. Will check some other mimetypes soon and post results, if any differences to normal behaviour sighted.

Comment 3

13 years ago
Popular filetypes and the mimetypes that major browsers return on WinXP:
ff= firefox ie=Iexplore6(XP)  op=opera 8.0
Exe - M$ executable
ff - application/x-msdownload 
ie - application/octet-stream
op - application/x-msdownload

Jpg - image
ff - image/jpeg
ie - image/pjpeg
op - image/jpeg

Png - image
ff png - image/png
ie png - image/x-png
op png - image/png

Odt - OpenOffice Document
ff - application/vnd.oasis.opendocument.text
ie - application/x-zip-compressed
op - application/octet-stream

Tgz - compressed archive
ff - application/x-gtar
ie - application/x-gzip-compressed
op - application/x-gzip

Rpm - redhat archive
ff - audio/x-pn-realaudio-plugin
ie - application/octet-stream
op - audio/x-pn-realaudio-plugin

I suggest using:
zip - application/zip
pdf - application/pdf
Rpm.. better to set this as M$Ie does? 
rpm - application/octet-stream

Comment 4

13 years ago
Same problem happens for Microsoft Excel - Content-Type: text/ms-excel-file. Only Windows Firefox 1.5 is affected. Problem didn't exist in Win Firefox 1.0.

XLS - Microsoft Excel
ff 1.5 Win - text/ms-excel-file
ff 1.5 Linux - application/vnd.ms-excel
ff 1.5 Mac - application/octet-stream
ff 1.0 Win - application/octet-stream
ie - application/octet-stream
op 8.5 Win - application/vnd.ms-excel
safari 1.3 - application/vnd.ms-excel
suggested - application/octet-stream (per MS's own choice in IE)

(tested on Windows XP, MacOs 10.3.9, Linux Ubuntu 6.0.6)

Other popular Office files (word, powerpoint) are OK.

Comment 5

12 years ago
Are these all dupes of each other? Or perhaps related to another meta-bug?

Bug 373621 – File upload set mime type as application/download instead of application/pdf (edit)
Bug 323462 – Sent pdf file is damaged, if sent in IE it is fine using yahoo mail (edit)
Bug 336212 – Firefox won't upload pdf files from academic medical journal websites. IE will upload pdf immediately (edit)
Bug 326821 – Mimetype output wrong on upload via php($_FILES -file_type) with FF (edit)
To all problem reporters:
Please read Bug 373621 Comment #5 and check mimeTypes.rdf content.
Is there multiple definitions or unexpected definition for ".pdf"?  

Comment 7

11 years ago
Mime Type for PDF files returned by firefox is "application/octetstream" instead of "application/octet-stream" or "application/pdf"
This bug was reported on Firefox 2.x or older, which is no longer supported and will not be receiving any more updates. I strongly suggest that you update to Firefox 3.6.3 or later, update your plugins (flash, adobe, etc.), and retest in a new profile. If you still see the issue with the updated Firefox, please post here. Otherwise, please close as RESOLVED > WORKSFORME
Whiteboard: [CLOSEME 5-15-2010]
Version: unspecified → 1.5.0.x Branch
No reply, INCOMPLETE. Please retest with Firefox 3.6.3 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Last Resolved: 9 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.