MIME 类型及相关介绍

MIME类型介绍

MIME (Multipurpose Internet Mail Extensions) 是描述消息内容类型的标准,用来表示文档、文件或字节流的性质和格式。

MIME 消息能包含文本、图像、音频、视频以及其他应用程序专用的数据。

浏览器通常使用 MIME 类型(而不是文件扩展名)来确定如何处理URL,因此 We b服务器在响应头中添加正确的 MIME 类型非常重要。如果配置不正确,浏览器可能会无法解析文件内容,网站将无法正常工作,并且下载的文件也会被错误处理。

语法

MIME 类型通用结构:

type/subtype

MIME 的组成结构非常简单,由类型与子类型两个字符串中间用 / 分隔而组成,不允许有空格。type 表示可以被分多个子类的独立类别,subtype 表示细分后的每个类型。

MIME类型对大小写不敏感,但是传统写法都是小写。

两种主要的 MIME 类型在默认类型中扮演了重要的角色:

  • text/plain 表示文本文件的默认值。
  • application/octet-stream 表示所有其他情况的默认值。

常见的 MIME 类型

  • 超文本标记语言文本 .html、.htmltext/html

  • 普通文本 .txttext/plain

  • RTF 文本 .rtfapplication/rtf

  • GIF 图形 .gifimage/gif

  • JPEG 图形 .jpeg、.jpgimage/jpeg

  • au 声音文件 .auaudio/basic

  • MIDI 音乐文件 mid、.midiaudio/midi、audio/x-midi

  • RealAudio 音乐文件 .ra、.ramaudio/x-pn-realaudio

  • MPEG 文件 .mpg、.mpegvideo/mpeg

  • AVI 文件 .avivideo/x-msvideo

  • GZIP 文件 .gzapplication/x-gzip

  • TAR 文件 .tarapplication/x-tar

类型描述典型示例
text表明文件是普通文本,理论上是人类可读text/plain, text/html, text/css, text/javascript
image表明是某种图像。不包括视频,但是动态图(比如动态gif)也使用image类型image/gif, image/png, image/jpeg, image/bmp, image/webp, image/x-icon, image/vnd.microsoft.icon
audio表明是某种音频文件audio/midi, audio/mpeg, audio/webm, audio/ogg, audio/wav
video表明是某种视频文件video/webm, video/ogg
application表明是某种二进制数据

application/octet-stream, application/pkcs12, application/vnd.mspowerpoint, application/xhtml+xml, application/xmlapplication/pdf

MIME 对照表

媒体类型文件扩展名说明
application/msworddoc微软 Office Word 格式(Microsoft Word 97 – 2004 document)
application/vnd.openxmlformats-officedocument.wordprocessingml.documentdocx微软 Office Word 文档格式
application/vnd.ms-excelxls微软 Office Excel 格式(Microsoft Excel 97 – 2004 Workbook
application/vnd.openxmlformats-officedocument.spreadsheetml.sheetxlsx微软 Office Excel 文档格式
application/vnd.ms-powerpointppt微软 Office PowerPoint 格式(Microsoft PowerPoint 97 – 2003 演示文稿)
application/vnd.openxmlformats-officedocument.presentationml.presentationpptx微软 Office PowerPoint 文稿格式
application/x-gzipgz, gzipGZ 压缩文件格式
application/zipzip, 7zipZIP 压缩文件格式
application/rarrarRAR 压缩文件格式
application/x-tartar, tgzTAR 压缩文件格式
application/pdfpdfPDF 是 Portable Document Format 的简称,即便携式文档格式
application/rtfrtfRTF 是指 Rich Text Format,即通常所说的富文本格式
image/gifgifGIF 图像格式
image/jpegjpg, jpegJPG(JPEG) 图像格式
image/jp2jpg2JPG2 图像格式
image/pngpngPNG 图像格式
image/tifftif, tiffTIF(TIFF) 图像格式
image/bmpbmpBMP 图像格式(位图格式)
image/svg+xmlsvg, svgzSVG 图像格式
image/webpwebpWebP 图像格式
image/x-iconicoico 图像格式,通常用于浏览器 Favicon 图标
application/kswpswps金山 Office 文字排版文件格式
application/ksetet金山 Office 表格文件格式
application/ksdpsdps金山 Office 演示文稿格式
application/x-photoshoppsdPhotoshop 源文件格式
application/x-coreldrawcdrCoreldraw 源文件格式
application/x-shockwave-flashswfAdobe Flash 源文件格式
text/plaintxt普通文本格式
application/x-javascriptjsJavascript 文件类型
text/javascriptjs表示 Javascript 脚本文件
text/csscss表示 CSS 样式表
text/htmlhtm, html, shtmlHTML 文件格式
application/xhtml+xmlxht, xhtmlXHTML 文件格式
text/xmlxmlXML 文件格式
text/x-vcardvcfVCF 文件格式
application/x-httpd-phpphp, php3, php4, phtmlPHP 文件格式
application/java-archivejarJava 归档文件格式
application/vnd.android.package-archiveapkAndroid 平台包文件格式
application/octet-streamexeWindows 系统可执行文件格式
application/x-x509-user-certcrt, pemPEM 文件格式
audio/mpegmp3mpeg 音频格式
audio/midimid, midimid 音频格式
audio/x-wavwavwav 音频格式
audio/x-mpegurlm3um3u 音频格式
audio/x-m4am4am4a 音频格式
audio/oggoggogg 音频格式
audio/x-realaudioraReal Audio 音频格式
video/mp4mp4mp4 视频格式
video/mpegmpg, mpe, mpegmpeg 视频格式
video/quicktimeqt, movQuickTime 视频格式
video/x-m4vm4vm4v 视频格式
video/x-ms-wmvwmvwmv 视频格式(Windows 操作系统上的一种视频格式)
video/x-msvideoaviavi 视频格式
video/webmwebmwebm 视频格式
video/x-flvflv一种基于 flash 技术的视频格式

按照内容类型排列的 MIME 类型列表

类型/子类型扩展名
application/envoyevy
application/fractalsfif
application/futuresplashspl
application/htahta
application/internet-property-streamacx
application/mac-binhex40hqx
application/msworddoc
application/msworddot
application/octet-stream*
application/octet-streambin
application/octet-streamclass
application/octet-streamdms
application/octet-streamexe
application/octet-streamlha
application/octet-streamlzh
application/odaoda
application/olescriptaxs
application/pdfpdf
application/pics-rulesprf
application/pkcs10p10
application/pkix-crlcrl
application/postscriptai
application/postscripteps
application/postscriptps
application/rtfrtf
application/set-payment-initiationsetpay
application/set-registration-initiationsetreg
application/vnd.ms-excelxla
application/vnd.ms-excelxlc
application/vnd.ms-excelxlm
application/vnd.ms-excelxls
application/vnd.ms-excelxlt
application/vnd.ms-excelxlw
application/vnd.ms-outlookmsg
application/vnd.ms-pkicertstoresst
application/vnd.ms-pkiseccatcat
application/vnd.ms-pkistlstl
application/vnd.ms-powerpointpot
application/vnd.ms-powerpointpps
application/vnd.ms-powerpointppt
application/vnd.ms-projectmpp
application/vnd.ms-workswcm
application/vnd.ms-workswdb
application/vnd.ms-workswks
application/vnd.ms-workswps
application/winhlphlp
application/x-bcpiobcpio
application/x-cdfcdf
application/x-compressz
application/x-compressedtgz
application/x-cpiocpio
application/x-cshcsh
application/x-directordcr
application/x-directordir
application/x-directordxr
application/x-dvidvi
application/x-gtargtar
application/x-gzipgz
application/x-hdfhdf
application/x-internet-signupins
application/x-internet-signupisp
application/x-iphoneiii
application/x-javascriptjs
application/x-latexlatex
application/x-msaccessmdb
application/x-mscardfilecrd
application/x-msclipclp
application/x-msdownloaddll
application/x-msmediaviewm13
application/x-msmediaviewm14
application/x-msmediaviewmvb
application/x-msmetafilewmf
application/x-msmoneymny
application/x-mspublisherpub
application/x-msschedulescd
application/x-msterminaltrm
application/x-mswritewri
application/x-netcdfcdf
application/x-netcdfnc
application/x-perfmonpma
application/x-perfmonpmc
application/x-perfmonpml
application/x-perfmonpmr
application/x-perfmonpmw
application/x-pkcs12p12
application/x-pkcs12pfx
application/x-pkcs7-certificatesp7b
application/x-pkcs7-certificatesspc
application/x-pkcs7-certreqrespp7r
application/x-pkcs7-mimep7c
application/x-pkcs7-mimep7m
application/x-pkcs7-signaturep7s
application/x-shsh
application/x-sharshar
application/x-shockwave-flashswf
application/x-stuffitsit
application/x-sv4cpiosv4cpio
application/x-sv4crcsv4crc
application/x-tartar
application/x-tcltcl
application/x-textex
application/x-texinfotexi
application/x-texinfotexinfo
application/x-troffroff
application/x-trofft
application/x-trofftr
application/x-troff-manman
application/x-troff-meme
application/x-troff-msms
application/x-ustarustar
application/x-wais-sourcesrc
application/x-x509-ca-certcer
application/x-x509-ca-certcrt
application/x-x509-ca-certder
application/ynd.ms-pkipkopko
application/zipzip
audio/basicau
audio/basicsnd
audio/midmid
audio/midrmi
audio/mpegmp3
audio/x-aiffaif
audio/x-aiffaifc
audio/x-aiffaiff
audio/x-mpegurlm3u
audio/x-pn-realaudiora
audio/x-pn-realaudioram
audio/x-wavwav
image/bmpbmp
image/cis-codcod
image/gifgif
image/iefief
image/jpegjpe
image/jpegjpeg
image/jpegjpg
image/pipegjfif
image/svg+xmlsvg
image/tifftif
image/tifftiff
image/x-cmu-rasterras
image/x-cmxcmx
image/x-iconico
image/x-portable-anymappnm
image/x-portable-bitmappbm
image/x-portable-graymappgm
image/x-portable-pixmapppm
image/x-rgbrgb
image/x-xbitmapxbm
image/x-xpixmapxpm
image/x-xwindowdumpxwd
message/rfc822mht
message/rfc822mhtml
message/rfc822nws
text/csscss
text/h323323
text/htmlhtm
text/htmlhtml
text/htmlstm
text/iulsuls
text/plainbas
text/plainc
text/plainh
text/plaintxt
text/richtextrtx
text/scriptletsct
text/tab-separated-valuestsv
text/webviewhtmlhtt
text/x-componenthtc
text/x-setextetx
text/x-vcardvcf
video/mpegmp2
video/mpegmpa
video/mpegmpe
video/mpegmpeg
video/mpegmpg
video/mpegmpv2
video/quicktimemov
video/quicktimeqt
video/x-la-asflsf
video/x-la-asflsx
video/x-ms-asfasf
video/x-ms-asfasr
video/x-ms-asfasx
video/x-msvideoavi
video/x-sgi-moviemovie
x-world/x-vrmlflr
x-world/x-vrmlvrml
x-world/x-vrmlwrl
x-world/x-vrmlwrz
x-world/x-vrmlxaf
x-world/x-vrmlxof

按照文件扩展名排列的 MIME 类型列表

扩展名类型/子类型
 application/octet-stream
323text/h323
acxapplication/internet-property-stream
aiapplication/postscript
aifaudio/x-aiff
aifcaudio/x-aiff
aiffaudio/x-aiff
asfvideo/x-ms-asf
asrvideo/x-ms-asf
asxvideo/x-ms-asf
auaudio/basic
avivideo/x-msvideo
axsapplication/olescript
bastext/plain
bcpioapplication/x-bcpio
binapplication/octet-stream
bmpimage/bmp
ctext/plain
catapplication/vnd.ms-pkiseccat
cdfapplication/x-cdf
cerapplication/x-x509-ca-cert
classapplication/octet-stream
clpapplication/x-msclip
cmximage/x-cmx
codimage/cis-cod
cpioapplication/x-cpio
crdapplication/x-mscardfile
crlapplication/pkix-crl
crtapplication/x-x509-ca-cert
cshapplication/x-csh
csstext/css
dcrapplication/x-director
derapplication/x-x509-ca-cert
dirapplication/x-director
dllapplication/x-msdownload
dmsapplication/octet-stream
docapplication/msword
dotapplication/msword
dviapplication/x-dvi
dxrapplication/x-director
epsapplication/postscript
etxtext/x-setext
evyapplication/envoy
exeapplication/octet-stream
fifapplication/fractals
flrx-world/x-vrml
gifimage/gif
gtarapplication/x-gtar
gzapplication/x-gzip
htext/plain
hdfapplication/x-hdf
hlpapplication/winhlp
hqxapplication/mac-binhex40
htaapplication/hta
htctext/x-component
htmtext/html
htmltext/html
htttext/webviewhtml
icoimage/x-icon
iefimage/ief
iiiapplication/x-iphone
insapplication/x-internet-signup
ispapplication/x-internet-signup
jfifimage/pipeg
jpeimage/jpeg
jpegimage/jpeg
jpgimage/jpeg
jsapplication/x-javascript
latexapplication/x-latex
lhaapplication/octet-stream
lsfvideo/x-la-asf
lsxvideo/x-la-asf
lzhapplication/octet-stream
m13application/x-msmediaview
m14application/x-msmediaview
m3uaudio/x-mpegurl
manapplication/x-troff-man
mdbapplication/x-msaccess
meapplication/x-troff-me
mhtmessage/rfc822
mhtmlmessage/rfc822
midaudio/mid
mnyapplication/x-msmoney
movvideo/quicktime
movievideo/x-sgi-movie
mp2video/mpeg
mp3audio/mpeg
mpavideo/mpeg
mpevideo/mpeg
mpegvideo/mpeg
mpgvideo/mpeg
mppapplication/vnd.ms-project
mpv2video/mpeg
msapplication/x-troff-ms
mvbapplication/x-msmediaview
nwsmessage/rfc822
odaapplication/oda
p10application/pkcs10
p12application/x-pkcs12
p7bapplication/x-pkcs7-certificates
p7capplication/x-pkcs7-mime
p7mapplication/x-pkcs7-mime
p7rapplication/x-pkcs7-certreqresp
p7sapplication/x-pkcs7-signature
pbmimage/x-portable-bitmap
pdfapplication/pdf
pfxapplication/x-pkcs12
pgmimage/x-portable-graymap
pkoapplication/ynd.ms-pkipko
pmaapplication/x-perfmon
pmcapplication/x-perfmon
pmlapplication/x-perfmon
pmrapplication/x-perfmon
pmwapplication/x-perfmon
pnmimage/x-portable-anymap
pot,application/vnd.ms-powerpoint
ppmimage/x-portable-pixmap
ppsapplication/vnd.ms-powerpoint
pptapplication/vnd.ms-powerpoint
prfapplication/pics-rules
psapplication/postscript
pubapplication/x-mspublisher
qtvideo/quicktime
raaudio/x-pn-realaudio
ramaudio/x-pn-realaudio
rasimage/x-cmu-raster
rgbimage/x-rgb
rmiaudio/mid
roffapplication/x-troff
rtfapplication/rtf
rtxtext/richtext
scdapplication/x-msschedule
scttext/scriptlet
setpayapplication/set-payment-initiation
setregapplication/set-registration-initiation
shapplication/x-sh
sharapplication/x-shar
sitapplication/x-stuffit
sndaudio/basic
spcapplication/x-pkcs7-certificates
splapplication/futuresplash
srcapplication/x-wais-source
sstapplication/vnd.ms-pkicertstore
stlapplication/vnd.ms-pkistl
stmtext/html
svgimage/svg+xml
sv4cpioapplication/x-sv4cpio
sv4crcapplication/x-sv4crc
swfapplication/x-shockwave-flash
tapplication/x-troff
tarapplication/x-tar
tclapplication/x-tcl
texapplication/x-tex
texiapplication/x-texinfo
texinfoapplication/x-texinfo
tgzapplication/x-compressed
tifimage/tiff
tiffimage/tiff
trapplication/x-troff
trmapplication/x-msterminal
tsvtext/tab-separated-values
txttext/plain
ulstext/iuls
ustarapplication/x-ustar
vcftext/x-vcard
vrmlx-world/x-vrml
wavaudio/x-wav
wcmapplication/vnd.ms-works
wdbapplication/vnd.ms-works
wksapplication/vnd.ms-works
wmfapplication/x-msmetafile
wpsapplication/vnd.ms-works
wriapplication/x-mswrite
wrlx-world/x-vrml
wrzx-world/x-vrml
xafx-world/x-vrml
xbmimage/x-xbitmap
xlaapplication/vnd.ms-excel
xlcapplication/vnd.ms-excel
xlmapplication/vnd.ms-excel
xlsapplication/vnd.ms-excel
xltapplication/vnd.ms-excel
xlwapplication/vnd.ms-excel
xofx-world/x-vrml
xpmimage/x-xpixmap
xwdimage/x-xwindowdump
zapplication/x-compress
zipapplication/zip

© 版权声明
THE END
喜欢就支持一下吧
点赞0赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容