Internet Explorer and the pjpeg MIME type
Posted on Friday, August 28th, 2009 under internet explorer, mime types
Did I mention that I hate Internet Explorer? Well, I do. I think that the web would be a much better place without Internet Explorer. Any Internet Explorer.
Today I’ve ran across another strange IE bug. When uploading a JPEG file, instead of the usual image/jpeg MIME as defined in RFC 1341, if the file is a progressive jpeg, then Internet Explorer sends a non standard MIME of image/pjpeg, which sucks, isn’t documented and breaks validation logic.
And since my code had something like:
# check mime type mime, type = image.content_type.split( '/' ) if not ( mime == 'image' and type in ['jpeg', 'gif', 'png'] ): return False
…in it, well…you can imagine! So, if you *ever* check the MIME type of a file, remember that IE sometimes sends a image/pjpeg MIME.
No IE / No headaches