MIME-Types

MIME-Types (MIME 类型)

The Multipurpose Internet Mail Extensions, known also as MIME type, is a specification extending the format of email to support sending images, audio/video files, archives, etc. The specification is standardized in IETF RFC 6838. (多用途互联网邮件扩展,也称为MIME类型,是一种扩展电子邮件格式以支持发送图像、音频/视频文件、存档等的规范。该规范在IETF RFC 6838中进行了标准化。)

Browsers generally use the MIME type (and not the file extension) to determine how to process a document; that’s why it is important to set up servers correctly for attaching a proper MIME type to the response object’s header. If it is not configured correctly, browsers may misinterpret the files’ contents, and sites won’t work correctly. Downloaded files may be mishandled as well. (浏览器通常使用MIME类型(而不是文件扩展名)来确定如何处理文档;这就是为什么正确设置服务器以将正确的MIME类型附加到响应对象的标头非常重要。 如果配置不正确,浏览器可能会误解文件的内容,网站将无法正常工作。 下载的文件也可能处理不当。)

Syntax

Syntax (语法)

Type/Subtype

The structure of MIME-type consists of a type and subtype, separated by a slash (/), without spaces. MIME-type is not case-sensitive, but it is commonly written in lower case. (MIME类型的结构由类型和子类型组成,由斜杠(/)分隔,不带空格。MIME类型不区分大小写,但通常以小写写入。)

A MIME type must always have both a type and subtype. Each type has its set of possible subtypes. (MIME类型必须始终同时具有类型和子类型。每种类型都有其可能的子类型集。)

To provide additional details, you can use an optional parameter. (要提供其他详细信息,可以使用可选参数。)

type/subtype;parameter=value

MIME-types are divided into two types: discrete and multipart. Each of them has specific subtypes.

Discrete Types

Discrete Types (离散类型)

text/plain
text/html
image/jpeg
image/png
audio/mpeg
audio/ogg
audio/*
video/mp4
application/*
application/json
application/javascript
application/ecmascript
application/octet-stream
…

Discrete type indicates the category of the document, it can be one of the following:

TypeDescriptionExample of typical subtypes
applicationContains binary dataapplication/javascript, application/octet-stream,
application/pkcs12, application/vnd.mspowerpoint, application/xhtml+xml, application/xml, application/pdf
audioAudiofileaudio/midi , audio/mpeg, audio/webm, audio/ogg, audio/wav
examplePlaceholder in examplesaudio/example
fontFont/typeface datafont/woff, font/ttf, and font/otf
modelModel data for 3D objectmodel/3mf, model/vml
textText documenttext/plain , text/html , text/css, text/javascript
videoVideo filevideo/webm , video/ogg

For describing a text document, that doesn’t belong to a particular subtype, text/plain is used. Documents containing binary data without a specific subtype are described using application/octet-stream. (对于描述不属于特定子类型的文本文档,使用text/plain。使用application/octet-stream描述包含没有特定子类型的二进制数据的文档。)

Multipart Types

Multipart Types (多部分类型)

multipart/form-data
multipart/byteranges

Multipart types indicate a category of the document, which consists of several parts, and each one can belong to different MIME-types. (多部分类型表示文档的一个类别,它由多个部分组成,每个部分都可以属于不同的MIME类型。)

TypeDescriptionExample of typical subtypes
messageMessage that covers other messagesmessage/rfc822, message/partial
multipartData composed of multiple componentsmultipart/form-data, multipart/byteranges

Table of MIME-Types

Table of MIME-Types (MIME类型表)

File extensionMedia Types and Subtypes
123application/vnd.lotus-1-2-3
3dmfx-world/x-3dmf
3dsimage/x-3ds
669audio/x-mod
aiapplication/postscript
aifaudio/aiff
aifaudio/x-aiff
aiffaudio/aiff
aiffaudio/x-aiff
aniapplication/x-navi-animation
aosapplication/x-nokia-9000-communicator-add-on-software
apsapplication/mime
arcapplication/octet-stream
arjapplication/arj
arjapplication/octet-stream
artimage/x-jg
asfvideo/x-ms-asf
asmtext/x-asm
asptext/asp
asxapplication/x-mplayer2
asxvideo/x-ms-asf
asxvideo/x-ms-asf-plugin
auaudio/basic
auaudio/x-au
aviapplication/x-troff-msvideo
avivideo/avi
avivideo/msvideo
avivideo/x-msvideo
binapplication/mac-binary
binapplication/macbinary
binapplication/octet-stream
binapplication/x-binary
binapplication/x-macbinary
bmimage/bmp
bmpimage/bmp
bmpimage/x-windows-bmp
booapplication/book
bookapplication/book
ctext/x-c
c++text/plain
ccadapplication/book
classapplication/java
classapplication/java-byte-code
classapplication/x-java-class
comapplication/octet-stream
comtext/plain
conftext/plain
cpptext/x-c
cptapplication/mac-compactpro
cptapplication/x-compactpro
cptapplication/x-cpt
cssapplication/x-pointplus
csstext/css
dcrapplication/x-director
deftext/plain
difvideo/x-dv
dirapplication/x-director
dlvideo/dl
dlvideo/x-dl
docapplication/msword
dotapplication/msword
drwapplication/drafting
dviapplication/x-dvi
dwgapplication/acad
dwgimage/vnd.dwg
dwgimage/x-dwg
dxfapplication/dxf
dxfimage/vnd.dwg
dxfimage/x-dwg
dxrapplication/x-director
exeapplication/octet-stream
gifimage/gif
gzapplication/x-compressed
gzapplication/x-gzip
gzipapplication/x-gzip
gzipmultipart/x-gzip
htext/plain
htext/x-h
hlpapplication/hlp
hlpapplication/x-helpfile
hlpapplication/x-winhelp
htctext/x-component
htmtext/html
htmltext/html
htmlstext/html
htttext/webviewhtml
icex-conference/x-cooltalk
icoimage/x-icon
infapplication/inf
jamaudio/x-jam
javtext/plain
javtext/x-java-source
javatext/plain
javatext/x-java-source
jcmapplication/x-java-commerce
jfifimage/jpeg
jfifimage/pjpeg
jfif-tbnlimage/jpeg
jpeimage/jpeg
jpeimage/pjpeg
jpegimage/jpeg
jpegimage/pjpeg
jpgimage/jpeg
jpgimage/pjpeg
jpsimage/x-jps
jsapplication/x-javascript
jsapplication/javascript
jsapplication/ecmascript
jstext/javascript
jstext/ecmascript
latexapplication/x-latex
lhaapplication/lha
lhaapplication/octet-stream
lhaapplication/x-lha
lhxapplication/octet-stream
listtext/plain
lspapplication/x-lisp
lsptext/x-script.lisp
lsttext/plain
lzhapplication/octet-stream
lzhapplication/x-lzh
lzxapplication/lzx
lzxapplication/octet-stream
lzxapplication/x-lzx
m3uaudio/x-mpequrl
manapplication/x-troff-man
midapplication/x-midi
midaudio/midi
midaudio/x-mid
midaudio/x-midi
midmusic/crescendo
midx-music/x-midi
midiapplication/x-midi
midiaudio/midi
midiaudio/x-mid
midiaudio/x-midi
midimusic/crescendo
midix-music/x-midi
modaudio/mod
modaudio/x-mod
movvideo/quicktime
movievideo/x-sgi-movie
mp2audio/mpeg
mp2audio/x-mpeg
mp2video/mpeg
mp2video/x-mpeg
mp2video/x-mpeq2a
mp3audio/mpeg3
mp3audio/x-mpeg-3
mp3video/mpeg
mp3video/x-mpeg
mp4video/mp4
mpaaudio/mpeg
mpavideo/mpeg
mpegvideo/mpeg
mpgaudio/mpeg
mpgvideo/mpeg
mpgaaudio/mpeg
pastext/pascal
pclapplication/vnd.hp-pcl
pclapplication/x-pcl
pctimage/x-pict
pcximage/x-pcx
pdfapplication/pdf
picimage/pict
pictimage/pict
pltext/plain
pltext/x-script.perl
pmimage/x-xpixmap
pmtext/x-script.perl-module
pm4application/x-pagemaker
pm5application/x-pagemaker
pngimage/png
potapplication/mspowerpoint
potapplication/vnd.ms-powerpoint
ppaapplication/vnd.ms-powerpoint
ppsapplication/mspowerpoint
ppsapplication/vnd.ms-powerpoint
pptapplication/mspowerpoint
pptapplication/powerpoint
pptapplication/vnd.ms-powerpoint
pptapplication/x-mspowerpoint
ppzapplication/mspowerpoint
psapplication/postscript
psdapplication/octet-stream
pwzapplication/vnd.ms-powerpoint
pytext/x-script.phyton
pycapplicaiton/x-bytecode.python
qtvideo/quicktime
qtifimage/x-quicktime
raaudio/x-pn-realaudio
raaudio/x-pn-realaudio-plugin
raaudio/x-realaudio
ramaudio/x-pn-realaudio
rmapplication/vnd.rn-realmedia
rmaudio/x-pn-realaudio
rpmaudio/x-pn-realaudio-plugin
rtfapplication/rtf
rtfapplication/x-rtf
rtftext/richtext
rtxapplication/rtf
rtxtext/richtext
rvvideo/vnd.rn-realvideo
sgmltext/sgml
sgmltext/x-sgml
shapplication/x-bsh
shapplication/x-sh
shapplication/x-shar
shtext/x-script.sh
shtmltext/html
shtmltext/x-server-parsed-html
ssitext/x-server-parsed-html
tarapplication/x-tar
tclapplication/x-tcl
tcltext/x-script.tcl
textapplication/plain
texttext/plain
tgzapplication/gnutar
tgzapplication/x-compressed
tifimage/tiff
tifimage/x-tiff
tiffimage/tiff
tiffimage/x-tiff
txttext/plain
uritext/uri-list
vcdapplication/x-cdlink
vmdapplication/vocaltec-media-desc
vrmlapplication/x-vrml
vrmlmodel/vrml
vrmlx-world/x-vrml
vsdapplication/x-visio
vstapplication/x-visio
vswapplication/x-visio
wavaudio/wav
wavaudio/x-wav
wmfwindows/metafile
xlaapplication/excel
xlaapplication/x-excel
xlaapplication/x-msexcel
xlbapplication/excel
xlbapplication/vnd.ms-excel
xlbapplication/x-excel
xlcapplication/excel
xlcapplication/vnd.ms-excel
xlcapplication/x-excel
xldapplication/excel
xldapplication/x-excel
xlkapplication/excel
xlkapplication/x-excel
xllapplication/excel
xllapplication/vnd.ms-excel
xllapplication/x-excel
xlmapplication/excel
xlmapplication/vnd.ms-excel
xlmapplication/x-excel
xlsapplication/excel
xlsapplication/vnd.ms-excel
xlsapplication/x-excel
xlsapplication/x-msexcel
xltapplication/excel
xltapplication/x-excel
xlvapplication/excel
xlvapplication/x-excel
xlwapplication/excel
xlwapplication/vnd.ms-excel
xlwapplication/x-excel
xlwapplication/x-msexcel
xmaudio/xm
xmlapplication/xml
xmltext/xml
zapplication/x-compress
zapplication/x-compressed
zipapplication/x-compressed
zipapplication/x-zip-compressed
zipapplication/zip
zipmultipart/x-zip
zooapplication/octet-stream
zooapplication/x-zoo
zshtext/x-scriptzsh


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部