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:
Type | Description | Example of typical subtypes |
---|---|---|
application | Contains binary data | application/javascript, application/octet-stream, |
application/pkcs12, application/vnd.mspowerpoint, application/xhtml+xml, application/xml, application/pdf | ||
audio | Audiofile | audio/midi , audio/mpeg, audio/webm, audio/ogg, audio/wav |
example | Placeholder in examples | audio/example |
font | Font/typeface data | font/woff, font/ttf, and font/otf |
model | Model data for 3D object | model/3mf, model/vml |
text | Text document | text/plain , text/html , text/css, text/javascript |
video | Video file | video/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类型。)
Type | Description | Example of typical subtypes |
---|---|---|
message | Message that covers other messages | message/rfc822, message/partial |
multipart | Data composed of multiple components | multipart/form-data, multipart/byteranges |
Table of MIME-Types
Table of MIME-Types (MIME类型表)
File extension | Media Types and Subtypes |
---|---|
123 | application/vnd.lotus-1-2-3 |
3dmf | x-world/x-3dmf |
3ds | image/x-3ds |
669 | audio/x-mod |
ai | application/postscript |
aif | audio/aiff |
aif | audio/x-aiff |
aiff | audio/aiff |
aiff | audio/x-aiff |
ani | application/x-navi-animation |
aos | application/x-nokia-9000-communicator-add-on-software |
aps | application/mime |
arc | application/octet-stream |
arj | application/arj |
arj | application/octet-stream |
art | image/x-jg |
asf | video/x-ms-asf |
asm | text/x-asm |
asp | text/asp |
asx | application/x-mplayer2 |
asx | video/x-ms-asf |
asx | video/x-ms-asf-plugin |
au | audio/basic |
au | audio/x-au |
avi | application/x-troff-msvideo |
avi | video/avi |
avi | video/msvideo |
avi | video/x-msvideo |
bin | application/mac-binary |
bin | application/macbinary |
bin | application/octet-stream |
bin | application/x-binary |
bin | application/x-macbinary |
bm | image/bmp |
bmp | image/bmp |
bmp | image/x-windows-bmp |
boo | application/book |
book | application/book |
c | text/x-c |
c++ | text/plain |
ccad | application/book |
class | application/java |
class | application/java-byte-code |
class | application/x-java-class |
com | application/octet-stream |
com | text/plain |
conf | text/plain |
cpp | text/x-c |
cpt | application/mac-compactpro |
cpt | application/x-compactpro |
cpt | application/x-cpt |
css | application/x-pointplus |
css | text/css |
dcr | application/x-director |
def | text/plain |
dif | video/x-dv |
dir | application/x-director |
dl | video/dl |
dl | video/x-dl |
doc | application/msword |
dot | application/msword |
drw | application/drafting |
dvi | application/x-dvi |
dwg | application/acad |
dwg | image/vnd.dwg |
dwg | image/x-dwg |
dxf | application/dxf |
dxf | image/vnd.dwg |
dxf | image/x-dwg |
dxr | application/x-director |
exe | application/octet-stream |
gif | image/gif |
gz | application/x-compressed |
gz | application/x-gzip |
gzip | application/x-gzip |
gzip | multipart/x-gzip |
h | text/plain |
h | text/x-h |
hlp | application/hlp |
hlp | application/x-helpfile |
hlp | application/x-winhelp |
htc | text/x-component |
htm | text/html |
html | text/html |
htmls | text/html |
htt | text/webviewhtml |
ice | x-conference/x-cooltalk |
ico | image/x-icon |
inf | application/inf |
jam | audio/x-jam |
jav | text/plain |
jav | text/x-java-source |
java | text/plain |
java | text/x-java-source |
jcm | application/x-java-commerce |
jfif | image/jpeg |
jfif | image/pjpeg |
jfif-tbnl | image/jpeg |
jpe | image/jpeg |
jpe | image/pjpeg |
jpeg | image/jpeg |
jpeg | image/pjpeg |
jpg | image/jpeg |
jpg | image/pjpeg |
jps | image/x-jps |
js | application/x-javascript |
js | application/javascript |
js | application/ecmascript |
js | text/javascript |
js | text/ecmascript |
latex | application/x-latex |
lha | application/lha |
lha | application/octet-stream |
lha | application/x-lha |
lhx | application/octet-stream |
list | text/plain |
lsp | application/x-lisp |
lsp | text/x-script.lisp |
lst | text/plain |
lzh | application/octet-stream |
lzh | application/x-lzh |
lzx | application/lzx |
lzx | application/octet-stream |
lzx | application/x-lzx |
m3u | audio/x-mpequrl |
man | application/x-troff-man |
mid | application/x-midi |
mid | audio/midi |
mid | audio/x-mid |
mid | audio/x-midi |
mid | music/crescendo |
mid | x-music/x-midi |
midi | application/x-midi |
midi | audio/midi |
midi | audio/x-mid |
midi | audio/x-midi |
midi | music/crescendo |
midi | x-music/x-midi |
mod | audio/mod |
mod | audio/x-mod |
mov | video/quicktime |
movie | video/x-sgi-movie |
mp2 | audio/mpeg |
mp2 | audio/x-mpeg |
mp2 | video/mpeg |
mp2 | video/x-mpeg |
mp2 | video/x-mpeq2a |
mp3 | audio/mpeg3 |
mp3 | audio/x-mpeg-3 |
mp3 | video/mpeg |
mp3 | video/x-mpeg |
mp4 | video/mp4 |
mpa | audio/mpeg |
mpa | video/mpeg |
mpeg | video/mpeg |
mpg | audio/mpeg |
mpg | video/mpeg |
mpga | audio/mpeg |
pas | text/pascal |
pcl | application/vnd.hp-pcl |
pcl | application/x-pcl |
pct | image/x-pict |
pcx | image/x-pcx |
application/pdf | |
pic | image/pict |
pict | image/pict |
pl | text/plain |
pl | text/x-script.perl |
pm | image/x-xpixmap |
pm | text/x-script.perl-module |
pm4 | application/x-pagemaker |
pm5 | application/x-pagemaker |
png | image/png |
pot | application/mspowerpoint |
pot | application/vnd.ms-powerpoint |
ppa | application/vnd.ms-powerpoint |
pps | application/mspowerpoint |
pps | application/vnd.ms-powerpoint |
ppt | application/mspowerpoint |
ppt | application/powerpoint |
ppt | application/vnd.ms-powerpoint |
ppt | application/x-mspowerpoint |
ppz | application/mspowerpoint |
ps | application/postscript |
psd | application/octet-stream |
pwz | application/vnd.ms-powerpoint |
py | text/x-script.phyton |
pyc | applicaiton/x-bytecode.python |
qt | video/quicktime |
qtif | image/x-quicktime |
ra | audio/x-pn-realaudio |
ra | audio/x-pn-realaudio-plugin |
ra | audio/x-realaudio |
ram | audio/x-pn-realaudio |
rm | application/vnd.rn-realmedia |
rm | audio/x-pn-realaudio |
rpm | audio/x-pn-realaudio-plugin |
rtf | application/rtf |
rtf | application/x-rtf |
rtf | text/richtext |
rtx | application/rtf |
rtx | text/richtext |
rv | video/vnd.rn-realvideo |
sgml | text/sgml |
sgml | text/x-sgml |
sh | application/x-bsh |
sh | application/x-sh |
sh | application/x-shar |
sh | text/x-script.sh |
shtml | text/html |
shtml | text/x-server-parsed-html |
ssi | text/x-server-parsed-html |
tar | application/x-tar |
tcl | application/x-tcl |
tcl | text/x-script.tcl |
text | application/plain |
text | text/plain |
tgz | application/gnutar |
tgz | application/x-compressed |
tif | image/tiff |
tif | image/x-tiff |
tiff | image/tiff |
tiff | image/x-tiff |
txt | text/plain |
uri | text/uri-list |
vcd | application/x-cdlink |
vmd | application/vocaltec-media-desc |
vrml | application/x-vrml |
vrml | model/vrml |
vrml | x-world/x-vrml |
vsd | application/x-visio |
vst | application/x-visio |
vsw | application/x-visio |
wav | audio/wav |
wav | audio/x-wav |
wmf | windows/metafile |
xla | application/excel |
xla | application/x-excel |
xla | application/x-msexcel |
xlb | application/excel |
xlb | application/vnd.ms-excel |
xlb | application/x-excel |
xlc | application/excel |
xlc | application/vnd.ms-excel |
xlc | application/x-excel |
xld | application/excel |
xld | application/x-excel |
xlk | application/excel |
xlk | application/x-excel |
xll | application/excel |
xll | application/vnd.ms-excel |
xll | application/x-excel |
xlm | application/excel |
xlm | application/vnd.ms-excel |
xlm | application/x-excel |
xls | application/excel |
xls | application/vnd.ms-excel |
xls | application/x-excel |
xls | application/x-msexcel |
xlt | application/excel |
xlt | application/x-excel |
xlv | application/excel |
xlv | application/x-excel |
xlw | application/excel |
xlw | application/vnd.ms-excel |
xlw | application/x-excel |
xlw | application/x-msexcel |
xm | audio/xm |
xml | application/xml |
xml | text/xml |
z | application/x-compress |
z | application/x-compressed |
zip | application/x-compressed |
zip | application/x-zip-compressed |
zip | application/zip |
zip | multipart/x-zip |
zoo | application/octet-stream |
zoo | application/x-zoo |
zsh | text/x-scriptzsh |