List of HTTP picture types

Source: Internet
Author: User
Tags rfc

Today in doing a file upload function, I found that I always upload png pictures. After debugging found, it should be in the contenttype of the local judgment error. Later Baidu found an interesting phenomenon, I found that the image of PNG contenttype is not what I see in the registry image/png, but image/x-png. It also caused the upload of the PNG file is not the reason (and then read the information to know I found the wrong registry location). After their own tests, the results are as follows:

IE6

IE 8.0

Chrome

Firefox

Png

Image/x-png

Image/x-png

Image/png

Image/png

Jpg

Image/pjpeg

Image/jpeg

Image/jpeg

Image/jpeg

Jpeg

Image/pjpeg

Image/pjpeg

Image/jpeg

Image/jpeg

Bmp

Image/bmp

Image/bmp

Image/bmp

Image/bmp

By contrast, the contenttype of Chrome and Firefox are more of a real answer. So why are there these differences?

First, the MIME type:

MIME type is the type of file that sets an extension to open with an application, and when the file is accessed, the browser automatically opens with the specified application. Used to specify some client-defined file names and how some media files are opened.

The full name of the MIME is the "Multipurpose Internet Mail Extensions" Multipurpose Internet Messaging Extension Service, a Multipurpose Internet Mail Extension protocol that was first applied to the e-mail system in 1992, but later applied to browsers. The server tells the browser the type of multimedia data they send, and the notification means the MIME type of the multimedia data to let the browser know which information is MP3 and which are Shockwave files and so on. The server puts the MIME markers in the transferred data to tell the browser which plug-in to use to read the related files.

MIME can support mail messages in multiple formats, such as non-ASCII characters, binary format attachments, and so on. This standard is defined in; RFC 2045,; RFC 2046,; RFC 2047,; RFC 2048,; RFC 2049, etc. in RFC. RFC 2822, which has been transformed by RFC 822, stipulates that e-mail standards do not allow characters other than the 7-bit ASCII character set to be used in mail messages. Because of this, some non-English character messages and binary files, images, sounds, and other non text messages can not be transmitted in e-mail messages. MIME provides a symbolic method for representing a wide variety of data types.

After the browser receives the file, it goes to the plugin system to find out which plug-ins can recognize the files that are received by the read. If the browser does not know which plug-in system to call, it may tell the user that a plugin is missing, or that an existing plug-in may be selected directly to attempt to read the received file, which could cause the system to crash. The lack of a MIME identity in the transmitted information can be difficult to estimate because some computer systems may not fail, but some computers may crash as a result.

When the output is transferred to the browser, the browser must start the appropriate application to process the output document. This can be done through multiple types of MIME (multifunction Internet Mail Extensions protocol). In HTTP, the MIME type is defined in the Content-type header.

  

For example, suppose you are transferring a Microsoft Excel file to a client. Then the MIME type is "application/vnd.ms-excel". In most cases, the file is then routed to execl for processing (assuming we set Excel to handle a particular MIME type of application). In ASP, the method of setting MIME type is through the Response object's ContentType property.

Analysis of MIME types in IE:

In Microsoft Internet Explorer 4.0 and later, the MIME type determines the Findmimefromdata method that occurs when moniker through a URL. The identified MIME type allows the URL moniker and other components to find and start the correct Object server or application to handle the relevant content.

The server-supplied MIME type, if available

An examination of the actual contents associated with a downloaded URL

The file name associated with the downloaded content (assumed to is derived from the associated URL)

Registry settings (file name Extension/mime type associations or registered applications) in effect during the download

Registry Locations

Location used by Findmimefromdata to find MIME type and ProgID from file name extension:

hkey_classes_root\.***
Location used by Findmimefromdata to find application from ProgID:

Hkey_classes_root\<progid>\shell\open\command
Location used by URL monikers to find CLSIDs from MIME types:

HKEY_CLASSES_ROOT\MIME\Database\Content Type

The purpose of MIME type detection, or data sniffing, is to determine the MIME type (also known as content type or media t ype) of downloaded content using information from following four sources:

For specific information, refer to the MSDN documentation:

http://msdn.microsoft.com/zh-cn/library/ms775147 (v=vs.85). aspx detection algorithms for MIME types, and Findmimefromdata functions, and uploaded MIME The contents of the types chapters.

Why is there an X in front of Image/x-png:

There is a dedicated organization of the IANA on the Internet to confirm standard MIME types, but the Internet is growing too fast for many applications to wait for the IANA to confirm that the MIME types they use are standard types. So they use the method of X-opening in the category to identify that the category has not yet become a standard, such as X-gzip,x-tar. The fact that these types are widely used has become a fact standard. As long as both the client and the server recognize this MIME type, even if it is not a standard type, the client program can handle the data according to the MIME type using a specific processing method. For Web servers and browsers (including the operating system), the default is to set the standard and common MIME types, and only for unusual MIME types is it necessary to set up both the server and the client browser for identification.

Here's a discussion about image/x-png.

Http://stackoverflow.com/questions/2086374/what-is-the-difference-between-image-png-and-image-x-png.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.