What is a MIME type

Source: Internet
Author: User
Tags gtar

MIME, called "Multipurpose Internet Mail Extensions", is the exact Chinese name for "Multipurpose Internet Mail Extension." It is an e-mail technical specification that is currently widely used and is defined in RFC 2045-2049

What is a MIME type?-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, set up you want to send a Microsoft Excel file to the client. Then the MIME type is "application/vnd.ms-excel". In most cases, the file will then be routed to execl for processing (assuming we set execl as an application to handle a particular MIME type). In ASP, the method of setting MIME type is through the Response object's ContentType property.
Multimedia file format MIME

In the earliest HTTP protocol, there was no additional data type information, all the transmitted data was interpreted by the client as Hypertext Markup Language HTML document, and in order to support multimedia data types, the HTTP protocol used the MIME data type information appended to the document to identify the data type.

MIME is a multi-mesh Internet Mail extension designed to provide additional multimedia data when sending e-mail messages, allowing mail clients to process them according to their type. When it is supported by the HTTP protocol, however, its significance is even more pronounced. It makes the HTTP transmission not only ordinary text, but become rich and colorful.

Each MIME type is made up of two parts, preceded by a large category of data, such as sound audio, image image, and so on, followed by the definition of a specific kind.
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.

Because the MIME type is related to the suffix of the document, the server uses the suffix of the document to differentiate between the MIME types of the different files, and the correspondence between the document suffix and the MIME type must be defined in the server. When the client receives data from the server, it simply accepts the data stream from the server and does not know the name of the document, so the server must use additional information to tell the client the MIME type of the data. Before the server sends the real data, it sends the MIME type of the flag data, which is defined using the Content-type keyword, for example, for HTML documents, where the server first sends the following two lines of MIME identity information, which is not part of the real data file.

Content-type:text/html

Note that the second act is a blank line, which is necessary to use this empty line to separate the MIME information from the real data content. PHP code <?     $filetype =array ();     $filetype [' hqx ']= ' application/mac-binhex40 ';      $filetype [' bin ']= ' application/octet-stream ';     $filetype [' Oda ']= ' application/ Oda ";     $filetype [' PDF ']=" application/pdf ";     $filetype [' ai ']=" application/ Postsrcipt ";     $filetype [' EPS ']= ' application/postsrcipt ';     $filetype [' es ']= '] Application/postsrcipt ";     $filetype [' rtf ']= ' application/rtf ';     $filetype [' MIF '] ]= "APPLICATION/X-MIF";     $filetype [' csh ']= "application/x-csh";     $filetype [' DVI ' ]= "Application/x-dvi";     $filetype [' HDF ']= "APPLICATION/X-HDF";     $filetype [' NC '] = "APPLICATION/X-NETCDF";     $filetype [' CDF ']= ' application/x-netcdf ';     $filetype [ ' Latex ']= "Application/x-latex";     $filetype [' ts ']= "application/x-troll-ts";     $filetype [' src ']= "Application/x-wais-source";     $filetype [' Zip ']= ' application/zip ';     $filetype [' Bcpio ']= ' Application/x-bcpio '];      $filetype [' cpio ']= ' Application/x-cpio ';     $filetype [' Gtar ']= '] application/ X-gtar ";     $filetype [' Shar ']=" Application/x-shar ";     $filetype [' Sv4cpio ']= '] Application/x-sv4cpio ";     $filetype [' SV4CRC ']=" APPLICATION/X-SV4CRC ";     $ filetype[' tar ']= "Application/x-tar";     $filetype [' Ustar ']= "Application/x-ustar";      $filetype [' Man ']= "Application/x-troff-man";     $filetype [' sh ']= ' application/x-sh ';     $filetype [' tcl ']= ' application/x-tcl ';     $filetype [' Tex ']= ' Application/x-tex ';     $filetype [' Texi ']= ' application/x-texinfo ';     $filetype [' Texinfo ']= '] application/ X-texInfo ";     $filetype [' t ']=" Application/x-troff ";     $filetype [' tr ']= ' application/] X-troff ";     $filetype [' Roff ']=" Application/x-troff ";     $filetype [' Shar ']= '] Application/x-shar ";     $filetype [' Me ']=" application/x-troll-me ";     $filetype [' Ts ']= ' application/x-troll-ts ';     $filetype [' gif ']= ' image/gif ';     $filetype [' JPEG ']= "image/pjpeg";     $filetype [' jpg ']=array ("Image/pjpeg", "Image/jpeg");     $ filetype[' jpe ']= "image/pjpeg";     $filetype [' ras ']= ' image/x-cmu-raster];     $ filetype[' PBM ']= "Image/x-portable-bitmap";     $filetype [' ppm ']= "Image/x-portable-pixmap";     $filetype [' XBM ']= ' image/x-xbitmap ';     $filetype [' xwd ']= ' image/x-xwindowdump ';     $filetype [' ief ']= ' image/ief ';     $filetype [' tif ']= ' Image/tiff ';     $filetype [' TIFF ']= "Image/tiff";     $filetype [' PNM ']= "Image/x-portable-anymap";     $filetype [' PGM ']= "Image/x-portable-graymap";     $filetype [' RGB ']= "Image/x-rgb";      $filetype [' xpm ']= ' image/x-xpixmap ';     $filetype [' txt ']= ' text/plain ';     $ filetype[' C ']= "Text/plain";     $filetype [' CC ']= "Text/plain";     $filetype [' H ']= '] Text/plain ";     $filetype [' HTML ']=" text/html ";     $filetype [' htm ']=" text/html ";      $filetype [' Htl ']= ' text/html ';     $filetype [' rtx ']= ' text/richtext ';      $filetype [' etx ']= ' text/x-setext ';     $filetype [' TSV ']= ' text/tab-separated-values ';     $filetype [' mpeg ']= ' video/mpeg ';     $filetype [' avi ']= ' Video/avi ';     $ filetype[' rm ']= ' video/rm ';     $filetype [' rmvb ']= ' video/rmvb ';     $filetype[' wmv ']= "video/x-ms-wmv";     $filetype [' flv ']= "Application/octet-stream";      $filetype [' mpg ']= ' video/mpeg ';     $filetype [' mpe ']= ' video/mpeg ';     $ filetype[' avi ']= "Video/x-msvideo";     $filetype [' qt ']= ' video/quicktime];     $ filetype[' mov ']= "video/quicktime";     $filetype [' Moov ']= "Video/quicktime";     $ filetype[' movie ']= "Video/x-sgi-movie";     $filetype [' au ']= ' audio/basic];     $ filetype[' mp3 ']= "Audio/mp3";     $filetype [' snd ']= "Audio/basic";     $filetype [' wav ' ]= "Audio/wav";     $filetype [' wma ']= "audio/x-ms-wma";     $filetype [' AIF ']= ' audio/ X-aiff ";     $filetype [' Aiff ']=" Audio/x-aiff ";     $filetype [' aifc ']= ' Audio/x-aiff '];      $filetype [' swf ']= ' application/x-shockwave-flash ';     $filetype [' Doc ']= ' ApplicaTion/msword ";     $filetype [' ini ']= ' application/octet-stream ';    ?>      

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.