The MIME type is used to set a file extension.ProgramWhen the file with the extension is accessed, the browser automatically opens the file with the specified application. It is used to specify custom client file names and open media files.
The full name of mime is "Multipurpose Internet email extension", which is a multi-purpose Internet Mail extended protocol. It was first used in the email system in 1992, but later used in browsers. The server will tell the browser the type of multimedia data they send, and the notification means to indicate the MIME type of the multimedia data, so that the browser can know the received information which is MP3 files, which are shockwave files. The server puts the mime token into the transmitted data to tell the browser which plug-in is used to read the relevant file.
After the browser receives the file, it will go to the plug-in system to find out which plug-in can identify and read the received file. If the browser does not know which plug-in system to call, it may tell the user that a plug-in is missing, or directly select an existing plug-in to try to read the received file, the latter may cause a system crash. The absence of mime identifiers in the transmitted information may make it difficult to estimate the situation, because some computer systems may not have any faults, but some computers may crash.
To check whether a server correctly sets the MIME type, follow these steps:
1. Open the server webpage in the Netscape Browser
2. Go to the "View" menu and select "Page Info"
3. Click "embed" in the upper-layer framework in the pop-up window"
4. check whether the MIME type is "application/X-director" or "application/X-Shockwave-flash" in the lower-layer framework ", if the above information is used, it indicates that the server has correctly set the MIME type; if the MIME type lists text content, eight-bit data, or other forms, it indicates that the server's MIME type is not set correctly.
If the server does not correctly indicate the type of data it sends, the server administrator should correctly add relevant information. The specific operation method is very simple and quick.
Microsoft uses ActiveX controls instead of Netscape plug-ins in Windows browsers, which do not rely on mime encoding as other browsers do. The "CLSID" attribute of the "object" tag accurately identifies the program to be called to read the received file. Therefore, the browser does not have to select a reader like the "embed" tag. Because of this, you will often encounter mime problems when using a browser with plug-ins, while browsers using ActiveX controls rarely have such troubles.
Because of the differences in the above work methods, I wonder if you find that when you use the Netscape Browser to play wav files, the browser will call the liveconnect plug-in for playback, other browsers generally use the general QuickTime playback plug-in to play the video. This is because the Netscape Browser needs to read the mime identifier to receive the file, so as to decide which program to call to read the received file, the liveconnect plug-in should be used for server settings to play wav files in the Netscape browser. Therefore, when the Netscape Browser receives files in WAV format, it must call the liveconnect plug-in, however, because other browsers do not use this method, they all use the default player for playing wav files. Of course, flash movie files do not have this problem, because only Flash players can correctly read files in this format.
When sending the output result to a browser, the browser must start an appropriate application to process the output document. This can be done through multiple types of mime (multi-function Internet Mail Extension protocol. In HTTP, the MIME type is defined in the Content-Type header.
For example, suppose you want to transfer a Microsoft Excel file to the client. The MIME type is "application/vnd. MS-excel ". In most cases, this file is then transmitted to execl for processing (assuming we set execl to an application that handles special MIME types ). In ASP, the method for setting the MIME type is through the contenttype attribute of the response object.
Multimedia file format MIME
In the earliest HTTP protocol, there was no additional data type information. All transmitted data was interpreted by the client program as HTML documents in the hypertext markup language. to support multimedia data types, the MIME data type information appended to the document is used in the HTTP protocol to identify the data type.
Mime is an extension of multi-object Internet mail. It is designed to attach multimedia data to an email so that the mail client program can process it based on its type. However, when it is supported by the HTTP protocol, its meaning becomes more significant. It makes HTTP transmitted not only plain text, but also rich and colorful.
Each MIME type consists of two parts. The front part is a large data type, such as audio, image, and so on. The latter part defines a specific type.
Common MIME types
Hypertext markup language text |
.Html, .html |
Text/html |
Common text |
. Txt |
Text/plain |
RTF Text |
. Rtf |
Application/RTF |
GIF Image |
. Gif |
Image/GIF |
JPEG Image |
.Ipeg,.jpg |
Image/JPEG |
AU sound file |
. Au |
Audio/basic |
MIDI music files |
Mid,. MIDI |
Audio/Midi, audio/X-Midi |
RealAudio music file |
. Ra,. Ram |
Audio/X-PN-RealAudio |
MPEG file |
. Mpg,. MPEG |
Video/MPEG |
AVI file |
. Avi |
Video/X-msvideo |
Gzip file |
. GZ |
Application/X-Gzip |
Tar file |
. Tar |
Application/X-Tar |
There is a dedicated IANA organization in the Internet to confirm the standard MIME type, but the Internet is growing too fast, and many applications cannot wait for IANA to confirm that they are using the standard MIME type. Therefore, they use methods starting with X-in the category to identify this category, such as X-gzip and X-tar. In fact, these types are widely used and have become the de facto standard. As long as the client and server acknowledge this mime type together, even if it is not a standard type, the client program can process data according to the MIME type. In web servers and browsers (including operating systems), standard and common MIME types are set by default, the server and client browser must be set for identification.
Because the MIME type is related to the document suffix, the server uses the document suffix to distinguish the MIME types of different files. The server must define the correspondence between the document suffix and the MIME type. When a customer program receives data from the server, it only accepts data streams from the server and does not know the document name. Therefore, the server must use additional information to tell the customer program the MIME type of data. Before the server sends real data, it must first send the MIME type information of the Flag data. This information is defined using the Content-Type keyword. For example, for HTML documents, the server will first send the following two lines of mime identification information, which is not part of a real data file.
Content-Type: text/html
Note that the second act is a blank line, which is required to separate the mime information from the real data content.