Zerth00 Zerth00 - 20 days ago 5
Javascript Question

html <input type="file"> .jpeg extension wont display when using image/jpeg or image/pjpeg in Firefox

I have been trying to create a custom file filter for my file uploader however I have noticed that in Firefox that my filter I use does not display .jpeg file extension in the "File Upload" dialog box

for example my filter javascript 'fileType : ["image/jpeg", "image/png", "application/pdf"],

this would translate to in HTML as accept="image/jpeg, image/png, application/pdf"

This filter works correctly in Chrome and IE and they display in the dialog box as "Custom Files" and they both show .jpeg extensions and only display those allowed files.

However the filter does not display in Firefox it displays as "All files (.)" and then shows the filter in a drop down underneath the "All files" as "All Supported Types(*.jpg; *.png; *.pdf;" and it ignores the .jpeg extension thus not displaying files with the .jpeg extension

I have checked the Mime types and I am using the right one I even tried using image/pjpeg

I have been on the bugzilla forums and found some information regarding this but can't find a solution or work around

I have checked IIS7's allowed Mime types and no problem was found there

Any solutions or options would be appreciated

cheers

Lee

ndm ndm
Answer

Well, it looks like treating the filters as non-default is intentional

https://bugzilla.mozilla.org/show_bug.cgi?id=826185#c3

[...] However, Jonas stated in comment 21 that we should make these filters non-default in a first step, waiting for users feedback (like yours ;) to maybe change this behavior. [...]

https://bugzilla.mozilla.org/show_bug.cgi?id=565274#c21

[...] Like I said, I'm ok with doing the mimetype service lookup and creating a non-default filter based on that. That seems like a good first step and it gives us a chance to get feedback on how well the mapping works. [...]

And there seem to be some bugs around this whole stuff, in Firefox 22 on Windows 7 it shows *.jpg,*.jpg in the filter for image/jpeg, where as it should probably be *.jpg,*.jpeg. In the current nightly 25.0a1 it only shows *.jpg, and application/pdf isn't recognized at all.

As far as I can tell there is no way to workaround any of this behavior, also it might be OS dependent.

Comments