stop_ie 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 looked 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.

Just remember: No IE / No headaches