Users can use MIME to set up a server to transmit multimedia such as sound and animation information, which may be done by the CGI script. In the following article, you can learn about MIME and knowledge about using MIME on the web.
MIME is a technical specification that is originally used for email, and now you can now use information on your browser to deliver the browser to identify, about MIME knowledge and is very difficult, there are some basic computers The concept can be understood, but if you want to use it, you must pay attention to the content. In fact, we have come into contact with MIME when I go online, just the browser and server implementation.
MIME is sometimes incorrectly understood as multimedia Internet mail extensions, this is an error, but MIME is often used on multimedia applications online, so people think that it is a multimedia email extension, but actually it It should be referred to as multi-purpose Internet mail extensions, which must be noted because sometimes there is no non-text component at all.
MIME is huge for the extension of the mail system, because before MIME, the letter content must be changed to the ASCII code or turn the binary information into the coding standard that can be transmitted, and the receiver must Decoding can obtain sound and drawing information. MIME provides a method of attaching a variety of different coded files in the message. This is much different from the original email. And now MIME has become a part of the HTTP protocol standard.
MIME is the main method of the server to notify the client transfer file, and the client browser also tells the server to its parameters via MIME. On the Internet, if the received file does not have a MIME head, it is the default it is an HTML format. But this is not good, because when MIME's Baotou is Text / Plain, the browser will directly display the parameters of its font, color, such as the parameters such as the color, not very good.
What is the MIME header looks like it is used in an email or on a browser, both of which may vary. For the email header, the version number, the content type declaration, the encoding method, and the content description are essential. This is the format used in the email head. In the following, we will focus on the MIME header in HTTP, and the MIME header is simple.
The following example is a standard MIME header:
MIME-VERSION: 1.0 // version number: 1.0
Content-type: Multipart / Mixed; Boundary = "ima.boundary.750407228" // content type is a variety of
- IMA.BOUNDARY.750407228
Content-type: text / plain; charset = us-ascii // Content type: text, character is ASCII
Content-Transfer-Encoding: 7bit // Coding Method: 7
Content-Description: CC: Mail Note Part
When used in the browser, the user does not need to know so much information, so the MIME header is relatively simple. When visiting a web page, a session is generated between the browser and the server. As part of the request content, the browser sends it to understand the MIME type description, which tells the server, what can the browser support, the server The information is generally not modified.
The server notifies the customer browser content through the MIME header of the client, let's take a look at the head below: Content-Type: Text / HTML
At the time of implementation, be sure to pay attention to the MIME header to follow an empty line, otherwise this world will be ignored by the browser, this header will be displayed as text. When the server transmits the GIF image, the world will be as follows:
Content-Type: Image / GIF
Content-Transfer-Encoding: binary
The usual MIME content type does not work, the browser can identify the type of content, but if you use some additional types, this problem can be big, if you use text / postscript, the browser will display download Window, or show this thing, it will not be good. Let's take a look at the standard MIME type.
Text. Text, which is used to describe different types of text, including usual text, PostScript, and HTML, although HTML is not a possible subtype.
Multipart. Multi-type indicating that this information includes a variety of information, more than one type.
Missage. Mark different types of messages.
Application. Application type.
Image. Image, used to indicate graphics files.
Sound, used to indicate the sound file.
Video, used to indicate animation files.
Each MIME type has a different subtype. In fact, you cannot use the type separately without using child type, there is only one exception, which is the "Telnet" type. IANA provides 45 types / subtype support. Of course, the standard is open, allowing users to customize their own type, and the user-defined type should be distinguished from "X". When adding new types, be careful, try to use the existing type to achieve your own purpose. If you want to add a new type, you must ensure that the server supports this type, but also to ensure that the client can also identify new types through some applications (such as plugins). If your site visits are wide, don't use new types easily, or use existing types, or register for IANA.