Non-standard image/pjpeg mimetype on IE

Published 14 Jan 2010 in Browsers, PHP & MySQL, Software by ZigPress

Here’s a lovely little Internet Explorer “feature” that may have web developers cursing, so I figured I would write a brief post about it in the hope that IE doesn’t waste an hour of your life like it did mine.

If you develop in PHP and need to add image upload functionality to a project, you will hopefully check the mimetype of each uploaded file to reduce the chance that it is a virus-laden script file or something equally nasty.

It’s quite easy to do by querying the “type” property of the uploaded file object. This page from the online PHP documentation has the details.

When checking an image upload, I normally check that the uploaded file’s mimetype is either image/jpeg, image/png or image/gif. These are standard mimetypes and everything works as it should, with users of the site uploading images to their hearts’ content.

Well, it works as it should until someone using Internet Explorer tries to upload a progressive JPEG image (a progressive JPEG is simply one that appears gradually more detailed when loaded, instead of loading from the top edge down). Every browser in the world treats such files as normal image/jpeg files, as they should. Except Internet Explorer of course, which uses the completely made-up mimetype of image/pjpeg.

Yes, that’s right, Microsoft invented their OWN mimetype for this solitary JPEG sub-type, presumably for no other reason than to annoy web developers the world over.

Add this to the list of mimetypes you check, and of course everything works fine. But you shouldn’t have to.

All I can say is, way to go Microsoft. Just when I thought you couldn’t surprise and disappoint me any more, you’ve succeeded in doing it again.


  1. On 14 Jan 2010 at 10:11, Klaus @ TechPatio said:

    Is this the case with IE 8 as well or only the older IE’s?

  2. On 14 Jan 2010 at 10:25, Andy Towler said:

    It came to my attention via IE7 but is also the case in IE8.

  3. On 14 Jan 2010 at 11:45, Tony said:

    Is this when you are uploading files via IE?

    I found users in my system were uploading pjpeg files and had to modify my image manipulation code to recognise it. I didn’t realise it was related to the IE browser.

    Don’t forget to check for image/jpg as well.

    And png is not naturally supported by IE6 browsers. So if you want to support those oldies who seem to want to avoid upgrading for life, its best to avoid png.

    If a user uploads any other image file format I instantly convert it to jpeg.

  4. On 14 Jan 2010 at 12:41, Andy Towler said:

    Hi Tony, yes it’s about accepting and processing uploads from browser forms. They all send image/jpeg except IE. As for IE6, it’s quite happy dealing with PNG files, it just won’t do alpha transparency properly. So I say to IE6 users: tough, upgrade. :)

  5. On 19 Jan 2010 at 17:33, Heidi Montag said:

    Internet explorer will pretty much be an after thought after all these countries coming out and telling people not to use IE due to its security flaws. The impact will be massive. Whens the new ie going to come out i wonder?

  6. On 20 Jan 2010 at 18:55, Manhattan said:

    Fortunately, the days of IE doing whatever the hell they want are coming to an end. With all the competition they’re going to have to get used to being standard.

  7. On 21 Jan 2010 at 02:25, kathie said:

    I was wondering about this, it’s not exactly the first time MS have just ignored standards but it’s started to get boring now. With all the security issues my workplace are looking at deploying firefox site wide and avoiding the security hell that IE introduces.

  8. On 29 Jan 2010 at 03:25, Ashburn Homes said:

    I guess Microsoft just keeps digging a bigger and bigger whole for themselves. I am almost starting to feel sorry for them!

  9. On 17 Mar 2010 at 13:52, Daniel Gibbs said:

    So annoying! I just fell into this trap with IE8. Such a waste of time. /rage

  10. On 13 Apr 2010 at 02:44, june marathon said:

    Great, just another annoyance. Billy Boy can do what he wants I guess! Hope someone overtakes him eventually.

  11. On 16 Apr 2010 at 05:40, Acai said:

    As to one of the other commenters: I don’t feel sorry for Microsoft! Why feel sorry for such a huge corporation who makes so much money hand over fist. I mean, I could feel sorry for them if they were doing their very best and still the underdog, but they are in no way the underdog!

  12. On 26 Apr 2010 at 20:43, MrZen said:

    A link from microsoft:

  13. On 28 Apr 2010 at 20:59, Lilly Bell said:

    Internet Explorer 8 is very good because it is as stable as Opera. I hate the previous versions of IE like IE6 because it hangs frequently. ‘

  14. On 10 May 2010 at 04:59, Daniel Saeper said:

    Back when Internet Explorer was first created it was top of the line, but the truth is all that has changed. There’s so many better browsers available, especially Mozilla Firefox of course.

    Even browsers like Flock & Google Chrome seem to have more options, are easier to use, are more secure & just overall a much better browser than IE. Looks like microsoft better come up with something quick or their browser’s going to be run out of the market.

  15. On 03 Dec 2010 at 10:45, South African Game Reserve said:

    Great Work… :)

  16. On 10 Dec 2010 at 16:51, UK Business Blog said:

    I have to agree with Daniel, Mozilla Firefox is much much superior for web developers, just take SEO Quake Toolbar for example. Functionality is much better with Firefox and much faster than IE.

  17. On 30 Mar 2011 at 15:11, Phil Video Games Mentor said:

    I still can’t believe anyone in their right mind is using IE. I stopped coding for it 2 years ago. Just got tired of writing two versions of websites…

  18. On 24 Apr 2011 at 08:38, TaoLiu said:

    Hi Tony, yes it’s about accepting and processing uploads from browser forms. They all send image/jpeg except IE. As for IE6, it’s quite happy dealing with PNG files, it just won’t do alpha transparency properly. So I say to IE6 users: tough, upgrade.

  19. On 24 May 2011 at 19:18, Marry @ A1C levels said:

    I’m a webdesigner and one of the most frustrating things is to do different versions of css for IE7, IE8, IE9 (thank god IE6 is no longer in the picture). The above example is just another example of this horrific thing.

  20. On 04 Oct 2011 at 14:07, John said:

    I have to agree with Lilly Bell on this. Although Internet Explorer may have run into a few problems over the last several years, MS have really started to get their act together recently, especially starting with v8.0 onwards. I think the overall user experience has improved significantly.

    Finally we should remember that even Firefox is not without its own problems (the memory leak and other issues took them a fair amount of time to sort out.)

  21. On 02 Jul 2012 at 16:35, Lothar said:

    thanks, this problem took 3 hours of my work.

  22. On 31 Jul 2013 at 16:43, Lonnie said:

    I had this issue today but quickly identified it when I dumped the $_FILES variable and saw pjpeg .. I knew I was only accepting jpeg and jpg.. I had never heard of pjpeg before as a mime type, so I searched google and found this..

    IE is still doing this in 2013 with IE9 and IE10 .. fortunately it was a simple fix.. but it was confusing being on the line with a client and him trying and failing to upload while I was succeeding with the same exact file.