see whatever…

jump to menu

January 22, 2006

image/pjpeg !

Filed under: PHP,Web — see @ 10:07 pm

Developing and testing mainly in Firefox even gives headaches with server side programming which I thought was browser-opaque. Wrong. I was wondering why an upload of a simple JPG image would fail. After some debugging I first noticed I was oppressing all error messages I wanted to give in the app I developed… Kind of embarassing as this was I missed the error message which would have explained the original error.

The actual error was coming from Internet Explorer’s strange behaviour not sending a MIME-type of “image/jpeg” as all sane browsers and I guess also all sane programmers would do but instead send an “image/pjpeg” which I did not expected and so did not handle.

So one fault for me but a really strange one for IE…


  1. pjpeg mime type refers to a progressive jpeg image. this means it can be streamed and displayed while it is loading. the target system will know ahead of time that it is displaying a progressive jpeg instead of a standard jpeg by the mime-type before the file even starts loading.

    not a bug. just a feature not supported by firefox, for some reason.

    Comment by Timothy — September 27, 2006 @ 6:02 am

  2. Thanks for the info, at least I now know what “p” in pjpeg means. And it does seem to make sense.

    Anyhow, although I am not fully aware of all available specs but according to image/pjpeg is not a registered mime-type. So I guess image/pjpeg is a proprietary extension by IE which rated by the amount of queries (via e.g. google) for image/pjpeg causes at least a bit confusion for developers.

    Nothing really to make a bug fuss about but at least for me it was annoying (but maybe I was just not well-enough informed).

    Comment by see — September 27, 2006 @ 1:30 pm

  3. Is there any way to get IE to quit doing this? My daughter’s just started it a week or so ago, and it’s really annoying. We never had a problem with it until then. It now takes away the original file names and renames ALL the images as “secure download” and turns them into pjpeg files. Safari can’t deal with it. Netscape doesn’t like it, but will open the file if you name an application to open it with. I quit using my copy of IE because it crashed all the time. Running a Mac, I can’t get the newest version.
    I don’t have trouble with any incoming images EXCEPT from that one machine. It’s a real pain!

    Comment by Pat Sahlin — September 10, 2007 @ 6:43 am

  4. I am not sure it is really a related problem. Anyhow, try to save the JPEG images not to be “progressive” (i.e. in Photoshop or Fireworks there is an option to save it without being progressive). I guess IE will use image/jpeg than as they are not p(rogressive) any more. But I have not tried that.

    Comment by see — September 10, 2007 @ 10:24 pm

  5. M$ is in violation of the standards. Non-registered MIME types are required to have a second part beginning with “x-”.

    Strangely, it does follow this rule for PNGs – it uses image/x-png. Even in IE8. I’ve just been looking to see when image/png registered. According to
    it was 14 October 1996, 13 days after the first PNG spec was released. So why didn’t IE use the standard MIME type from the beginning?

    Comment by Stewart — April 1, 2009 @ 4:02 pm

  6. First of all, from what I’ve seen it seems that image/pjpeg is used by IE regardless of the type of image. Also, it doesn’t make sense that a browser needs to know about this to handle the image in ‘progressive mode’ – any image can be painted on-the-fly, it’s just a question of whether it’s painted top-down or in progressive passes. So the image decoder can make that call, it’s not a transport issue (what’s next, jpeg-portrait, jpeg-landscape, jpeg-nsfw??)

    It’s very clear that IE is in violation of the spec, and as usual it has the unfortunate result that (a) people have extra work to accomodate it, since you know the b******s won’t patch it, and (b) perfectly functional things like firefox will get blamed for not supporting the same malfunction. You can all make your own call about whether this sort of thing is due to malice or incompetence, but the effect is the same. Like when a flagrant and obvious FrontPage bug put spaces in URLs (img src=”pix/My Cat.jpg”) and now all browsers have to violate the specs and mangle those URLs, or else they “won’t work” on certain web pages.

    If you are hosting a website that supports uploads you need to change your code to accomodate this, but please do not propogate the problem – if somebody uploads a file of type image/pjpeg, just accept it, but correct it to ‘image/jpeg’, so that if you serve the same file later it will have a valid type. If you just add ‘image/pjpeg’ to the supported list and serve the files out the same way, you are basically allowing IE to corrupt your site, and when firefox or something doesn’t work, that will actually be your fault. Standards are meant to be followed when possible, and things work much better when this is done.

    Comment by greg smith — August 4, 2009 @ 2:28 am

  7. I meant ‘regardless of the type of JPEG image’

    Comment by greg smith — August 4, 2009 @ 3:43 am

  8. I meant “image/pjpeg is used by IE regardless of the type of JPEG image.”

    Comment by greg smith — August 4, 2009 @ 3:45 am

  9. pjpeg mime type refers to a PROTECTED jpeg image, not progressive, hence the “secure download” message mentioned by Pat #3. Shame MS or anyone else don’t explain it, but if the image has copyright info attached, it is regarded as protected and won’t upload to many systems. See this article for full explanation and fix:

    Comment by marketing agency auckland — December 15, 2009 @ 7:26 am

  10. Check this:

    Comment by Pal — December 18, 2009 @ 12:00 pm

  11. Here’s what I did:
    Warning: If you are using Microsoft’s Internet Explorer.
    IE is not standards compliant and uploads jpeg’s and png’s with incorrect, non-standard mime types (pjpeg and x-png).
    These images will not be included in e-mails or pdf’s because they do not comply with specifications provided by IANA.
    These images may also be UNVIEWABLE by standards compliant browsers such as Firefox, Safari and Google Chrome.

    We recommend downloading and installing Firefox, Safari or Google Chrome and using this tool exclusively for uploading images.
    This will maximize the value of your information stored in this application.
    Management will not be responsible for rectifying issues created by uploading images with Microsoft’s Internet Explorer.
    Thank you.

    Comment by Gordon MacKay — February 5, 2010 @ 5:27 am

  12. What game is playin Microsoft’s Internet Explorer right now folks?

    They leaved a Standard way while chosing a way to create no standard things and make the world go complicated.
    Is it the start of the end goin on here?

    You get problems using CSS like in no other Browsers.. Now Jpeg images has changed to be recognised no more, chosing pjpeg extension and so on.. I found last something like x-png…, who want this?..

    I wish Internet Explorer to stop existing at all, so things will be better..

    Comment by jacko — August 13, 2010 @ 5:31 pm

  13. [...] image/pjpeg ! « see whatever…pjpeg mime type refers to a progressive jpeg image. this means it can be streamed and displayed while it is loading. the target system will know ahead of … [...]

    Pingback by Image pjpeg | ZukOnline — January 17, 2011 @ 10:03 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress