MIME type, Content-Type

Source: Internet
Author: User
Tags gtar

// Specify a stream that cannot be read by the client and must be downloaded.
Response. contenttype = "application/X-msdownload ";



The MIME type is the type used by an application to open a file with a certain extension. When a 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 Mail
Extensions "multi-function Internet
The Mail Extension Service is a multi-purpose Internet Mail Extension protocol. It was first used in the e-mail system in 1992, but later used in browsers. The server will tell the type of multimedia data they send
Browser, and the notification means to describe the MIME type of the multimedia data, so that the browser can know the received information which are MP3 files and shockwave files. Server Load balancer
The mime token is placed in the transmitted data to tell the browser which plug-in is used to read the relevant file.
Mime supports mail messages in multiple formats, including non-ASCII characters and binary format attachments. This standard is defined in;
RFC 2045,; RFC 2046,; RFC 2047,; RFC 2048, and RFC 2049. By RFC
RFC 822
2822. It is stipulated that the email standard does not allow the use of characters other than the 7-bit ASCII character set in mail messages. For this reason, non-English message and binary files, images, sounds, and other non-text Cancellation
Messages cannot be transmitted in emails. Mime specifies a symbolic method used to represent a variety of data types.
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 selects an existing plug-in to try to read the received file, which may cause the system to crash. Missing information transmitted
It is difficult to estimate the situations that may result from fewer mime identifiers, 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"
Check whether the MIME type is "application/X-director" or "application/X-Shockwave-
Flash ", if the above information indicates that the server has correctly set the MIME type, and if the MIME type lists text content, eight-bit data, or other forms, it indicates that the server
The 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 in Windows browsers instead
Netscape plug-in, which does 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
Therefore, the browser does not have to select a reader as the "embed" tag. Because of this, you will often encounter mime problems when using a browser with plug-ins.
ActiveX controls are rarely used in browsers.
Because of the differences in the above work methods, I wonder if you find that you are playing in the Netscape Browser.
When a WAV file is used, the browser calls the liveconnect plug-in to play the file. other browsers generally use the general QuickTime plug-in to play the file. This is because
The Netscape Browser needs to read the mime identifier to determine which program to call to read the received file, and the server sets to play the wav file in the Netscape Browser.
The liveconnect plug-in should be used, so the Netscape browser will call the liveconnect plug-in when receiving files in WAV format, but because other browsers do not
In this way, 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 this
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, assume that you want to transmit
Excel file to the client. The MIME type is "application/vnd. MS-excel ". In most cases, this file is then transmitted
Execl to process (Suppose we set execl to process applications of special MIME types ). In ASP, the method for setting the MIME type is through the response object
Contenttype attribute.
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. jpg image/JPEG
AU audio 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 evolving
Many applications cannot wait for IANA to confirm that the MIME type they use is of the standard type. Therefore, they use methods starting with X-in the category to identify this category. For example
For example, 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
It does not matter. The customer program can process data according to the MIME type. In web servers and browsers (including operating systems), standard and common
MIME type. Only for uncommon MIME types, you must set the server and client browser at the same time 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 the client program receives data from the server, it only accepts data streams from the server and does not know the document name.
You must use additional information to indicate the MIME type of the client program data. Before the server sends real data, it must first send the MIME type information of the Flag data.
The Content-Type keyword is defined. For example, for an HTML document, 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.
Mime utilizes the fact that RFC
822 the message body contains only simple ASCII text. Therefore, mime information is composed of normal Internet Text emails, text emails
It has some special information headers that comply with RFC 822 and formatted Information bodies (using ASCII
). These MIME headers provide a special way to indicate attachments in the mail.
Mime Information Analysis
The information of a common text mail contains a header (to: From: Subject:
And so on.
Mr .., and so on ). It is not surprising that a message header is contained in a mime-compliant message. Each part of the message is called a mime segment, and each segment is prefixed with a special header. Mime mail is only a base
An extension of RFC 822 mail. However, it has its own RFC specification set.
Header field
Based on the position in the package, the MIME header is generally divided into the mime information header and the mime field header. (TRANSLATOR: the MIME header refers to the entire mail header, while the MIME header is only the header of each mime segment .)
Mime information headers include:
This header provides the MIME Version Number used. This value is 1.0.
It defines the data type so that the data can be processed properly. Valid types include: text,
Image, audio, video,
Applications, multipart, and message. Note that any binary attachment should be called application/octet-
Stream. Some examples of this header are: image/jpg,
Application/mswork, multipart/mixed, which is only a small part.
This is the most important one in all headers, because it describes the encoding method for data.
The user/Mua will use it to decode the attachment. For each attachment, you can use 7bit, 8bit,
, Quoted-printable, base64, or custom. 7-bit encoding is used in us
A common encoding method in the ASCII character set, that is, keep it as it is. 8-bit and binary encoding are generally not used. Standard text that is readable to humans.
The quoted printable can be used to protect the gateway.
. Base64 is a common method. When you need to decide which encoding method to use, it provides a free-of-charge option. It is usually used in binary and non-text data. Note that any non-7bit
The data must be encoded in one mode so that it can be passed through the Internet Mail Gateway!
If the Content-Type is message/external-body or multipart/alternative
Header. It is beyond the scope of this article.
This is an optional Header. It is a free text description of any information segment. The description must use the US-ASCII code.
A pilot header that provides a prompt to the customer Program/Mua to determine whether to display the attachment within the row or as a separate attachment.
Mime field header (the header that appears in the actual mime attachment part). Besides the mime-version header
There are any of the above header fields. If a MIME header is part of an information block, it acts on the entire information body. For example, if content-transfer-encoding is displayed in
It is applied to the entire information body, but if it is displayed in a mime segment, it "can only" be used in that segment.
Note: It can automatically decrypt the received emails.
  MIME types

The format is followed by the suffix name, followed by the corresponding MIME type (for example, rar application/X-Rar-compressed indicates. rar corresponds to application/X-Rar-compressed)
Application/vnd. Lotus-1-2-3
3GP video/3GPP
AAB application/X-authoware-bin
AAM application/X-authoware-Map
AAS application/X-authoware-seg
AI Application/postscript
AIF audio/X-AIFF
Aifc audio/X-AIFF
ALS audio/X-Alpha5
AMC application/X-mPEG
Ani application/octet-stream
ASC text/plain
ASD application/astound
ASF video/X-MS-ASF
Asn application/astound
ASP application/X-ASAP
ASX video/X-MS-ASF
AU audio/basic
AVB application/octet-stream
AVI Video/X-msvideo
AWB audio/AMR-WB
Bcpio application/X-bcpio
Bin application/octet-stream
BLD application/BLD
Bld2 application/bld2
BMP application/X-MS-BMP
BPK application/octet-stream
Bz2 applications/x-bzip2
Cal image/X-cals
CCN application/X-CNC
CCO application/X-Cocoa
CDF application/X-netcdf
CGI Magnus-Internal/cgi
Chat application/X-chat
Class Application/octet-stream
CLP application/X-msclip
Cmx application/X-cmx
CO application/x-cult3d-object
Cod image/cis-COD
Cpio application/X-cpio
CPT application/MAC-compactpro
CRD application/X-mscardfile
CSH application/X-CSH
CSM chemical/X-csml
Csml chemical/X-csml
CSS text/CSS
Cur application/octet-stream
Dcm x-lml/X-EVM
DCR application/X-Director
Dcx image/X-dcx
DHTML text/html
Dir application/X-Director
DLL application/octet-stream
DMG application/octet-stream
DMS application/octet-stream
Doc application/MSWord
Dot application/X-dot
DVI application/X-DVI
DwF drawing/X-DwF
DWG application/X-AutoCAD
DXF application/X-AutoCAD
DxR application/X-Director
Ebk application/X-expandedbook
EMB chemical/X-embl-DL-nucleus otide
Embl chemical/X-embl-DL-nucleus otide
EPS application/postscript
ERI image/X-Eri
Es audio/echospeech
ESL audio/echospeech
Etc application/X-earthtime
Etx text/X-setext
Evm x-lml/X-EVM
Evy application/X-envoy
EXE application/octet-stream
Fh4 image/X-freehand
Fh5 image/X-freehand
FHC image/X-freehand
Fif image/FIF
FM application/X-maker
Fpx image/X-fpx
FVI video/isivideo
Gau chemical/X-Gaussian-Input
GCA application/X-GCA-compressed
Gdb x-lml/X-GDB
GIF image/GIF
GPS application/X-GPS
Gtar application/X-gtar
GZ application/X-Gzip
HDF application/X-HDF
HDM text/X-hdml
Hdml text/X-hdml
HLP application/WinHlp
Hqx application/mac-binhex40
Htm text/html
HTML text/html
HTS text/html
Ice X-conference/X-cooltalk
ICO application/octet-stream
IEF image/IEF
IFM image/GIF
Ifs image/IFS
IMy audio/melody
INS application/X-net-install
IPS application/X-ipscript
IPX application/X-ipix
It audio/X-mod
Itz audio/X-mod
Ivr I-World/I-Fig
J2k image/j2k
Jad text/vnd. Sun. J2EE. app-Descriptor
Jam application/X-jam
Jar application/Java-Archive
JNLP application/X-Java-JNLP-File
Jpe image/JPEG
Jpg image/JPEG
Jpz image/JPEG
JS application/X-Javascript
JWC application/JWC
Kjx application/X-kjx
AKs X-lml/X-aks
Latex application/X-latex
LCC application/fastman
LCL application/X-digitalloca
LCR application/X-digitalloca
Lgh application/lgh
Lha application/octet-stream
Lml X-lml/X-lml
Lmlpack X-lml/X-lmlpack
LSF video/X-MS-ASF
LSX video/X-MS-ASF
Lzh application/X-lzh
M13 application/X-msmediaview
M14 application/X-msmediaview
M15 audio/X-mod
M3U audio/X-mpegurl
M3url audio/X-mpegurl
Ma1 audio/ma1
Ma2 audio/Ma2
Ma3 audio/ma3
MA5 audio/MA5
MAN application/X-troff-man
Map Magnus-Internal/Imagemap
Mbd application/mbedlet
MCT application/X-mascot
MDB application/X-msaccess
Mdz audio/X-mod
Me application/X-troff-me
Mel text/X-vmel
Mi application/X-MIF
Mid audio/MIDI
MIF application/X-MIF
Mil image/X-cals
Mio audio/X-Mio
Mmf application/X-SKT-lbs
MNG video/X-MNG
Mny application/X-msmoney
MoC application/X-mocha
Mocha application/X-mocha
MoD audio/X-mod
MOF application/X-yumekara
Mol chemical/X-MDL-molfile
Mop chemical/X-mopac-Input
MoV video/QuickTime
Movie video/X-SGI-movie
MP2 audio/X-mPEG
MP3 audio/X-mPEG
MP4 video/MP4
Nmapplication/vnd. mpohun. Certificate
MPE video/MPEG
MPG video/MPEG
Mpg4 video/MP4
Mpga audio/MPEG
MPN application/vnd. mophun. Application
MPP application/vnd. MS-Project
MPs application/X-mapserver
MRl text/X-mrml
Mrm application/X-MRM
MS application/X-troff-MS
MTS application/metastream
CTX application/metastream
MTZ application/metastream
Mzv application/metastream
Nar application/zip
Nbmp image/nbmp
NC application/X-netcdf
Ndb x-lml/X-NDB
Ndwn application/ndwn
NIF application/X-NIF
Nmz application/X-scream
Nokia-op-logo image/vnd. Nok-oplogo-color
Npx application/X-netfpx
Nsnd audio/nsnd
NVA application/x-neva1
ODA application/ODA
Oom application/X-atlasmate-plugin
PAC audio/X-Pac
PAE audio/X-EPAC
Pan application/X-pan
PBM image/X-portable-bitmap
PCX image/X-PCX
PDA image/X-PDA
PDB chemical/X-PDB
PDF application/PDF
PFR application/font-tdpfr
PGM image/X-portable-graymap
PM application/X-perl
PMD application/X-PMD
PNM image/X-portable-anymap
PNZ image/PNG
Pot Application/vnd. MS-PowerPoint
PPM image/X-portable-pixmap
PPS Application/vnd. MS-PowerPoint
PPT application/vnd. MS-PowerPoint
Pqf application/X-cprplayer
Pqi application/cprplayer
PRC application/X-PRC
Proxy application/X-NS-proxy-AutoConfig
PS application/postscript
Ptlk application/listenup
Pub application/X-mspublisher
PVX video/X-Pv-PVX
Qcp audio/vnd. qcelp
Qt video/QuickTime
Qti image/X-QuickTime
QTIF image/X-QuickTime
R3t text/vnd. rn-realtext3d
RA audio/X-PN-RealAudio
Ram audio/X-PN-RealAudio
RAR application/X-Rar-compressed
Ras image/X-CMU-raster
RDF application/RDF + XML
RF image/vnd. Rn-realflash
RGB image/X-RGB
RLF application/X-richlink
Rm audio/X-PN-RealAudio
RMF audio/X-RMF
RMM audio/X-PN-RealAudio
Rmvb audio/X-PN-RealAudio
Rnx application/vnd. Rn-RealPlayer
Roff application/X-troff
RP image/vnd. Rn-realpix
Rpm audio/X-PN-RealAudio-plugin
RT text/vnd. Rn-RealText
Rte x-lml/X-GPS
RTF application/RTF
RTG application/metastream
RTX text/richtext
RV video/vnd. Rn-realvideo
RWC application/X-rogerwilco
S3m audio/X-mod
S3z audio/X-mod
SCA application/X-supercard
SCD application/X-msschedule
SDF application/e-Score
SEA application/X-stuffit
Sh application/X-SH
Shar application/X-shar
Shtml Magnus-Internal/parsed-html
SHW application/presentations
Si6 image/si6
Si7 image/vnd. stiwap. Sis
Si9 image/vnd. lgtwap. Sis
SIS application/vnd. Symbian. Install
Sit application/X-stuffit
SKD application/X-koan
SKM application/X-koan
SKP application/X-koan
SKT application/X-koan
SLC application/X-Salsa
SMD audio/X-SMD
SMI application/smil
SMIL application/smil
SMP application/studiom
SMZ audio/X-SMD
SND audio/basic
SPC text/X-speech
SPL application/futuresplash
SPR application/X-Sprite
Sprite application/X-Sprite
SPT application/X-SPT
SRC application/X-WAIS-Source
STK application/hyperstudio
STM audio/X-mod
Sv4cpio application/x-sv4cpio
Sv4crc application/x-sv4crc
SVF image/vnd
SVH image/SVH
Svr x-World/X-SVR
SWF application/X-Shockwave-flash
Swfl application/X-Shockwave-flash
T application/X-troff
Tad application/octet-stream
Talk text/X-speech
Tar application/X-Tar
Taz application/X-Tar
TBP application/X-Timbuktu
TBT application/X-Timbuktu
TCL application/X-tcl
Tex application/X-Tex
Texi application/X-texinfo
Texinfo application/X-texinfo
Tgz application/X-Tar
THM application/vnd. Eri. THM
TIF image/tiff
TIFF image/tiff
TKI application/X-tkined
Tkined application/X-tkined
TOC application/TOC
Toy image/toy
Tr application/X-troff
Trk x-lml/X-GPS
TRM application/X-msterminal
Tsi audio/tsplayer
TSP application/dsptype
TSV text/TAB-separated-Values
TSV text/TAB-separated-Values
TTF application/octet-stream
Ttz application/T-time
TXT text/plain
Ult audio/X-mod
USTAR application/X-USTAR
UU application/X-uuencode
UUE application/X-uuencode
VCD application/X-cdlink
VCF text/X-vCard
VDO video/VDO
VIB audio/ViB
Viv video/Vivo
Vivo video/Vivo
VMD application/vocaltec-media-Desc
Vmf application/vocaltec-media-File
VMI application/X-Dreamcast-VMS-Info
VMS application/X-Dreamcast-VMS
Vox audio/voxware
Vqe audio/X-twinvq-plugin
Vqf audio/X-twinvq
Vql audio/X-twinvq
Vre x-World/X-vream
Fig X-World/X-Fig
Vrt x-World/X-VRT
Vrw X-World/X-vream
VTS workbook/formulaone
WAV audio/X-WAV
Wax audio/X-MS-wax
Wbmp image/vnd. WAP. wbmp
Web application/vnd. xara
Wi image/Wavelet
WIS application/X-InstallShield
WM video/X-MS-WM
WMA audio/X-MS-WMA
WMD application/X-MS-WMD
WMF application/X-msmetafile
WML text/vnd. WAP. WML
Wmlc application/vnd. WAP. wmlc
WMLS text/vnd. WAP. WMLScript
Wmlsc application/vnd. WAP. wmlscriptc
WMLScript text/vnd. WAP. WMLScript
WMV audio/X-MS-WMV
Wmx video/X-MS-wmx
WMZ application/X-MS-WMZ
Wpng image/X-Up-wpng
Wpt x-lml/X-GPS
WRI application/X-mswrite
Wrl x-World/X-Fig
Wrz X-World/X-Fig
WS text/vnd. WAP. WMLScript
WSC application/vnd. WAP. wmlscriptc
WV video/Wavelet
WVX video/X-MS-WVX
Wxl application/X-wxl
X-gzip application/X-Gzip
Xar application/vnd. xara
Xbm image/X-xbitmap
Xdm application/X-xdma
Xdma application/X-xdma
Xdw application/vnd.fujixerox.doc uworks
Xht application/XHTML + XML
Xhtm application/XHTML + XML
XHTML application/XHTML + XML
Xla application/vnd. MS-Excel
Xlc application/vnd. MS-Excel
Xll application/X-Excel
XLM application/vnd. MS-Excel
XLS application/vnd. MS-Excel
Xlt application/vnd. MS-Excel
Xlw application/vnd. MS-Excel
XM audio/X-mod
XML text/XML
Xmz audio/X-mod
Xpi application/X-XPInstall
XPM image/X-xpixmap
Xsit text/XML
XSL text/XML
XUL text/XUL
Xwd image/X-xwindowdump
XYZ chemical/X-PDB
Yz1 application/x-yz1
Z application/X-compress
Zac application/X-zaurus-Zac
Zip application/zip

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.