Sunny Books
What we have

IE's non-standard image MIME type

When writing scripts for uploading images, we usually check the MIME type of each uploaded file to make sure that the file types are what we expect. It’s quite easy to do so by querying the “type” property of the uploaded file object. Normally, the standard MIME image types are: image/jpeg,image/png, or image/gif. this works fine for most browsers when users uploading images to their content, but not for Internet Explorer with versions less than 9.

Internet Explorer (versin less than 9) detacts image MIME type differently. It return a different set of MIME types for JPEG and PNG image formats.

If someone 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). Internet Explorer returns the file type as image/pjpeg, or image/x-citrix-pjpeg for the file sent from a citrix client while the other browsers treat it as a normal image/jpeg file. When uploading a PNG image, Internet Explorer return a file type as image/x-png (or image/x-citrix-png for the file sent from a citrix client) instead of the standard type image/png. These "x-" prefixed MIMe types are non-standard file types invented by Internet Explorer.

So, as developers, when writing an image upload script and checking for valid MIME types, we may need to check for the following list:

  • image/jpeg
  • image/gif
  • image/png
  • image/x-png
  • image/x-citrix-png
  • image/x-citrix-jpeg
  • image/pjpeg
SUNWEB EXPERT