各种文件后缀名对应的content-type
HTTP协议:Content-Type
HTTP协议:Content-TypePOST提交数据之---Content-Type的理解;Content-Type是指http/https发送信息⾄服务器时的内容编码类型,contentType⽤于表明发送数据流的类型,服务器根据编码类型使⽤特定的解析⽅式,获取数据流中的数据。
在⽹络请求中,常⽤的Content-Type有如下:text/html, text/plain, text/css, text/javascript, image/jpeg, image/png, image/gif,application/x-www-form-urlencoded, multipart/form-data, application/json, application/xml 等。
其中:text/html, text/plain, text/css, text/javascript, image/jpeg, image/png, image/gif, 都是常见的页⾯资源类型。
application/x-www-form-urlencoded, multipart/form-data, application/json, application/xml 这四个是ajax的请求,表单提交或上传⽂件的常⽤的资源类型。
form表单中可以定义enctype属性,该属性的含义是在发送到服务器之前应该如何对表单数据进⾏编码。
默认的情况下,表单数据会编码为"application/x-www-form-unlencoded".enctype常⽤的属性值如下:application/x-www-form-unlencoded:在发送前编码所有字符(默认情况下);multipart/form-data, 不对字符编码。
在使⽤⽂件上传时候,使⽤该值。
⼀:application/x-www-form-urlencoded 主要⽤于如下:1.1: 最常见的POST提交数据⽅式。
Mime-Type(Content-Type)
文件扩展名Content-Type(Mime-Type).*(二进制流,不知道下载文件类型)application/octet-stream0.001application/x-0010.323text/h3230.907drawing/907.acp audio/x-mei-aac .aif audio/aiff.aiff audio/aiff.asa text/asa.asp text/asp.au audio/basic.awf application/vnd.adob e.workflow.bmp application/x-bmp .c4t application/x-c4t.cal application/x-cals .cdf application/x-netcdf .cel application/x-cel.cg4application/x-g4.cit application/x-cit.cml text/xml.cmx application/x-cmx .crl application/pkix-crl .csi application/x-csi.cut application/x-cut.dbm application/x-dbm .dcd text/xml.der application/x-x509-ca-cert.dib application/x-dib.doc application/msword .drw application/x-drw .dwf Model/vnd.dwf.dwg application/x-dwg .dxf application/x-dxf.emf application/x-emf .ent text/xml.eps application/x-ps.etd application/x-ebx .fax image/fax.fif application/fractals .frm application/x-frm.gbr application/x-gbr.gif image/gif.gp4application/x-gp4 .hmr application/x-hmr .hpl application/x-hpl.hrf application/x-hrf.html text/html .htx text/html .ico image/x-icon .iff application/x-iff .igs application/x-igs .img application/x-img .isp application/x-internet-signup .java java/*.jpe image/jpeg .jpeg image/jpeg .jpg application/x-jpg .jsp text/html .lar application/x-laplayer-reg .lavs audio/x-liquid-secure .lmsff audio/x-la-lms .ltr application/x-ltr .m2v video/x-mpeg .m4e video/mpeg4.man application/x-troff-man .mdb application/msaccess .mfp application/x-shockwave-flash .mhtml message/rfc822.mid audio/mid .mil application/x-mil .mnd audio/x-musicnet-download .mocha application/x-javascript .mp1audio/mp1.mp2v video/mpeg .mp4video/mpeg4.mpd application/vnd.ms-project .mpeg video/mpg .mpga audio/rn-mpeg .mps video/x-mpeg .mpv video/mpg .mpw application/vnd.ms-project .mtx text/xml .net image/pnetvue .nws message/rfc822.out application/x-out .p12application/x-pkcs12.p7c application/pkcs7-mime .p7r application/x-pkcs7-certreqresp .pc5application/x-pc5.pdf application/pdf .pdx application/vnd.adob e.pdx .pgl application/x-pgl .pko application/vnd.ms-pki.pko .plg text/html .plt application/x-plt .png application/x-png .ppa application/vnd.ms-powerpoint .pps application/vnd.ms-powerpoint .ppt application/x-ppt .prf application/pics-rules .prt application/x-prt .ps application/postscript .pwz application/vnd.ms-powerpoint .ra audio/vnd.rn-realaudio .ras application/x-ras .rdf text/xml .red application/x-red .rjs application/vnd.rn-realsystem-rjs .rlc application/x-rlc .rm application/vnd.rn-realmedia .rmi audio/mid .rmm audio/x-pn-realaudio .rms application/vnd.rn-realmedia-secure .rmx application/vnd.rn-realsystem-rmx .rp image/vnd.rn-realpix .rsml application/vnd.rn-rsml .rtf application/msword .rv video/vnd.rn-realvideo .sat application/x-sat .sdw application/x-sdw .slb application/x-slb .slk drawing/x-slk .smil application/smil .snd audio/basic .sor text/plain .spl application/futurespla sh .ssm application/streaming media .stlapplication/vnd.ms-pki.stl.swf application/x-shockwave-flash.tg4application/x-tg4.tif image/tiff.tiff image/tiff.top drawing/x-top.tsd text/xml.uin application/x-icq.vcf text/x-vcard.vdx application/vnd.visio .vpg application/x-vpeg005.vsd application/x-vsd.vst application/vnd.visio .vsw application/vnd.visio .vtx application/vnd.visio .wav audio/wav.wb1application/x-wb1.wb3application/x-wb3.wiz application/msword .wk4application/x-wk4.wks application/x-wks.wma audio/x-ms-wma.wmf application/x-wmf.wmv video/x-ms-wmv.wmz application/x-ms-wmz .wpd application/x-wpd.wpl application/vnd.ms-wpl.wr1application/x-wr1.wrk application/x-wrk.ws2application/x-ws.wsdl text/xml.xdp application/vnd.adob e.xdp.xfd application/vnd.adob e.xfd.xhtml text/html.xls application/x-xls .xml text/xml.xq text/xml.xquery text/xml.xsl text/xml.xwd application/x-xwd.sis application/vnd.symbi an.install.x_t application/x-x_t.apk application/vnd.andro id.package-archive.tif image/tiff0.301application/x-3010.906application/x-906.ai application/postscript .aifc audio/aiff.anv application/x-anv.asf video/x-ms-asf.asx video/x-ms-asf.avi video/avi.biz text/xml.bot application/x-bot.c90application/x-c90.cat application/vnd.ms-pki.seccat.cdr application/x-cdr.cer application/x-x509-ca-cert.cgm application/x-cgm .class java/*.cmp application/x-cmp .cot application/x-cot.crt application/x-x509-ca-cert.css text/css.dbf application/x-dbf .dbx application/x-dbx .dcx application/x-dcx .dgn application/x-dgn.dll application/x-msdownload.dot application/msword .dtd text/xml.dwf application/x-dwf .dxb application/x-dxb.edn application/vnd.adob e.edn.eml message/rfc822.epi application/x-epi.eps application/postscript.exe application/x-msdownload.fdf application/vnd.fdf .fo text/xml.g4application/x-g4 .application/x-.gl2application/x-gl2 .hgl application/x-hgl .hpg application/x-hpgl.hqx application/mac-binhex40.hta application/hta .htm text/html.htt text/webviewhtml.iii application/x-iphone .ins application/x-internet-signup .IVF video/x-ivf .jfif image/jpeg .jpe application/x-jpe .jpg image/jpeg .js application/x-javascript .la1audio/x-liquid-file .latex application/x-latex .lbm application/x-lbm .ls application/x-javascript .m1v video/x-mpeg .m3u audio/mpegurl .mac application/x-mac .math text/xml .mdb application/x-mdb .mht message/rfc822.mi application/x-mi .midi audio/mid .mml text/xml .mns audio/x-musicnet-stream .movie video/x-sgi-movie .mp2audio/mp2.mp3audio/mp3.mpa video/x-mpg .mpe video/x-mpeg .mpg video/mpg .mpp application/vnd.ms-project .mpt application/vnd.ms-project .mpv2video/mpeg .mpx application/vnd.ms-project .mxp application/x-mmxp .nrf application/x-nrf .odc text/x-ms-odc .p10application/pkcs10.p7b application/x-pkcs7-certificates .p7m application/pkcs7-mime .p7s application/pkcs7-signature .pci application/x-pci .pcx application/x-pcx .pdfapplication/pdf.pls audio/scpls .png image/png.pot application/vnd.ms-powerpoint.ppm application/x-ppm.ppt application/vnd.ms-powerpoint.pr application/x-pr.prn application/x-prn.ps application/x-ps.ptn application/x-ptn.r3t text/vnd.rn-realtext3d .ram audio/x-pn-realaudio .rat application/rat-file.rec application/vnd.rn-recording.rgb application/x-rgb.rjt application/vnd.rn-realsystem-rjt.rle application/x-rle.rmf application/vnd.adob e.rmf.rmj application/vnd.rn-realsystem-rmj.rmp application/vnd.rn-rn_music_package.rmvb application/vnd.rn-realmedia-vbr.rnx application/vnd.rn-realplayer.rpm audio/x-pn-realaudio-plugin.rt text/vnd.rn-realtext .rtf application/x-rtf.sam application/x-sam .sdp application/sdp.sit application/x-stuffit .sld application/x-sld .smi application/smil.smk application/x-smk .sol text/plain.spc application/x-pkcs7-certificates.spp text/xml.sst application/vnd.ms-pki.certstore.stm text/html .svg text/xml.tld text/xml .torrent application/x-bittorrent .txt text/plain .uls text/iuls .vda application/x-vda .vml text/xml .vsd application/vnd.visio .vss application/vnd.visio .vst application/x-vst .vsx application/vnd.visio .vxml text/xml .wax audio/x-ms-wax .wb2application/x-wb2.wbmp image/vnd.wap.wbm p .wk3application/x-wk3.wkq application/x-wkq .wm video/x-ms-wm .wmd application/x-ms-wmd .wml text/vnd.wap.wml .wmx video/x-ms-wmx .wp6application/x-wp6.wpg application/x-wpg .wq1application/x-wq1.wri application/x-wri .ws application/x-ws .wsc text/scriptlet .wvx video/x-ms-wvx .xdr text/xml .xfdf application/vnd.adob e.xfdf .xls application/vnd.ms-excel .xlw application/x-xlw .xpl audio/scpls .xql text/xml .xsd text/xml .xslt text/xml .x_b application/x-x_b .sisx application/vnd.symbi an.install .ipa application/vnd.iphon e .xap application/x-silverlight-app。
[收藏]ContentType类型大全
[收藏]ContentType类型⼤全".*"="application/octet-stream"".001"="application/x-001"".301"="application/x-301"".323"="text/h323"".906"="application/x-906"".907"="drawing/907"".a11"="application/x-a11"".acp"="audio/x-mei-aac"".ai"="application/postscript"".aif"="audio/aiff"".aifc"="audio/aiff"".aiff"="audio/aiff"".anv"="application/x-anv"".asa"="text/asa"".asf"="video/x-ms-asf"".asp"="text/asp"".asx"="video/x-ms-asf"".au"="audio/basic"".avi"="video/avi"".awf"="application/vnd.adobe.workflow"".biz"="text/xml"".bmp"="application/x-bmp"".bot"="application/x-bot"".c4t"="application/x-c4t"".c90"="application/x-c90"".cal"="application/x-cals"".cat"="application/vnd.ms-pki.seccat"".cdf"="application/x-netcdf"".cdr"="application/x-cdr"".cel"="application/x-cel"".cer"="application/x-x509-ca-cert"".cg4"="application/x-g4"".cgm"="application/x-cgm"".cit"="application/x-cit"".class"="java/*"".cml"="text/xml"".cmp"="application/x-cmp"".cmx"="application/x-cmx"".cot"="application/x-cot"".crl"="application/pkix-crl"".crt"="application/x-x509-ca-cert"".csi"="application/x-csi"".css"="text/css"".cut"="application/x-cut"".dbf"="application/x-dbf"".dbm"="application/x-dbm"".dbx"="application/x-dbx"".dcd"="text/xml"".dcx"="application/x-dcx"".der"="application/x-x509-ca-cert"".dgn"="application/x-dgn"".dib"="application/x-dib"".dll"="application/x-msdownload"".doc"="application/msword"".dot"="application/msword"".drw"="application/x-drw"".dtd"="text/xml"".dwf"="Model/vnd.dwf"".dwf"="application/x-dwf"".dwg"="application/x-dwg"".dxb"="application/x-dxb"".dxf"="application/x-dxf"".edn"="application/vnd.adobe.edn"".emf"="application/x-emf"".ent"="text/xml"".epi"="application/x-epi"".eps"="application/x-ps"".eps"="application/postscript"".etd"="application/x-ebx"".exe"="application/x-msdownload" ".fax"="image/fax"".fdf"="application/vnd.fdf"".fif"="application/fractals"".fo"="text/xml"".frm"="application/x-frm"".g4"="application/x-g4"".gbr"="application/x-gbr"".gcd"="application/x-gcd"".gif"="image/gif"".gl2"="application/x-gl2"".gp4"="application/x-gp4"".hgl"="application/x-hgl"".hmr"="application/x-hmr"".hpg"="application/x-hpgl"".hpl"="application/x-hpl"".hqx"="application/mac-binhex40" ".hrf"="application/x-hrf"".hta"="application/hta"".htc"="text/x-component"".htm"="text/html"".html"="text/html"".htt"="text/webviewhtml"".htx"="text/html"".icb"="application/x-icb"".ico"="image/x-icon"".ico"="application/x-ico"".iff"="application/x-iff"".ig4"="application/x-g4"".igs"="application/x-igs"".iii"="application/x-iphone"".img"="application/x-img"".ins"="application/x-internet-signup" ".isp"="application/x-internet-signup" ".IVF"="video/x-ivf"".java"="java/*"".jfif"="image/jpeg"".jpe"="image/jpeg"".jpe"="application/x-jpe"".jpeg"="image/jpeg"".jpg"="image/jpeg"".jpg"="application/x-jpg"".js"="application/x-javascript"".jsp"="text/html"".la1"="audio/x-liquid-file"".lar"="application/x-laplayer-reg" ".latex"="application/x-latex"".lavs"="audio/x-liquid-secure"".lbm"="application/x-lbm"".lmsff"="audio/x-la-lms"".ls"="application/x-javascript"".ltr"="application/x-ltr"".m1v"="video/x-mpeg"".m2v"="video/x-mpeg"".m3u"="audio/mpegurl"".m4e"="video/mpeg4"".mac"="application/x-mac"".man"="application/x-troff-man"".math"="text/xml"".mdb"="application/msaccess"".mdb"="application/x-mdb"".mfp"="application/x-shockwave-flash"".mhtml"="message/rfc822"".mi"="application/x-mi"".mid"="audio/mid"".midi"="audio/mid"".mil"="application/x-mil"".mml"="text/xml"".mnd"="audio/x-musicnet-download" ".mns"="audio/x-musicnet-stream" ".mocha"="application/x-javascript" ".movie"="video/x-sgi-movie"".mp1"="audio/mp1"".mp2"="audio/mp2"".mp2v"="video/mpeg"".mp3"="audio/mp3"".mp4"="video/mpeg4"".mpa"="video/x-mpg"".mpd"="application/vnd.ms-project" ".mpe"="video/x-mpeg"".mpeg"="video/mpg"".mpg"="video/mpg"".mpga"="audio/rn-mpeg"".mpp"="application/vnd.ms-project" ".mps"="video/x-mpeg"".mpt"="application/vnd.ms-project" ".mpv"="video/mpg"".mpv2"="video/mpeg"".mpw"="application/vnd.ms-project" ".mpx"="application/vnd.ms-project" ".mtx"="text/xml"".mxp"="application/x-mmxp"".net"="image/pnetvue"".nrf"="application/x-nrf"".nws"="message/rfc822"".odc"="text/x-ms-odc"".out"="application/x-out"".p10"="application/pkcs10"".p12"="application/x-pkcs12"".p7b"="application/x-pkcs7-certificates" ".p7c"="application/pkcs7-mime"".p7m"="application/pkcs7-mime"".p7r"="application/x-pkcs7-certreqresp" ".p7s"="application/pkcs7-signature" ".pc5"="application/x-pc5"".pci"="application/x-pci"".pcl"="application/x-pcl"".pcx"="application/x-pcx"".pdf"="application/pdf"".pdf"="application/pdf"".pdx"="application/vnd.adobe.pdx" ".pfx"="application/x-pkcs12"".pgl"="application/x-pgl"".pic"="application/x-pic"".pko"="application/vnd.ms-pki.pko" ".pl"="application/x-perl"".plg"="text/html"".pls"="audio/scpls"".plt"="application/x-plt"".png"="image/png"".png"="application/x-png"".pot"="application/vnd.ms-powerpoint" ".ppa"="application/vnd.ms-powerpoint" ".ppm"="application/x-ppm"".pps"="application/vnd.ms-powerpoint" ".ppt"="application/vnd.ms-powerpoint" ".ppt"="application/x-ppt"".pr"="application/x-pr"".prf"="application/pics-rules"".prt"="application/x-prt"".ps"="application/x-ps"".ps"="application/postscript"".ptn"="application/x-ptn"".pwz"="application/vnd.ms-powerpoint"".r3t"="text/vnd.rn-realtext3d"".ra"="audio/vnd.rn-realaudio"".ram"="audio/x-pn-realaudio"".ras"="application/x-ras"".rat"="application/rat-file"".rdf"="text/xml"".rec"="application/vnd.rn-recording"".red"="application/x-red"".rgb"="application/x-rgb"".rjs"="application/vnd.rn-realsystem-rjs"".rjt"="application/vnd.rn-realsystem-rjt"".rlc"="application/x-rlc"".rle"="application/x-rle"".rm"="application/vnd.rn-realmedia"".rmf"="application/vnd.adobe.rmf"".rmi"="audio/mid"".rmj"="application/vnd.rn-realsystem-rmj" ".rmm"="audio/x-pn-realaudio"".rmp"="application/vnd.rn-rn_music_package" ".rms"="application/vnd.rn-realmedia-secure" ".rmvb"="application/vnd.rn-realmedia-vbr" ".rmx"="application/vnd.rn-realsystem-rmx" ".rnx"="application/vnd.rn-realplayer"".rp"="image/vnd.rn-realpix"".rpm"="audio/x-pn-realaudio-plugin"".rsml"="application/vnd.rn-rsml"".rt"="text/vnd.rn-realtext"".rtf"="application/msword"".rtf"="application/x-rtf"".rv"="video/vnd.rn-realvideo"".sam"="application/x-sam"".sat"="application/x-sat"".sdp"="application/sdp"".sdw"="application/x-sdw"".sit"="application/x-stuffit"".slb"="application/x-slb"".sld"="application/x-sld"".slk"="drawing/x-slk"".smi"="application/smil"".smil"="application/smil"".smk"="application/x-smk"".snd"="audio/basic"".sol"="text/plain"".sor"="text/plain"".spc"="application/x-pkcs7-certificates"".spl"="application/futuresplash"".spp"="text/xml"".ssm"="application/streamingmedia"".sst"="application/vnd.ms-pki.certstore"".stl"="application/vnd.ms-pki.stl"".stm"="text/html"".sty"="application/x-sty"".svg"="text/xml"".swf"="application/x-shockwave-flash"".tdf"="application/x-tdf"".tg4"="application/x-tg4"".tga"="application/x-tga"".tif"="image/tiff"".tif"="application/x-tif"".tiff"="image/tiff"".tld"="text/xml"".top"="drawing/x-top"".tsd"="text/xml"".txt"="text/plain"".uin"="application/x-icq"".uls"="text/iuls"".vcf"="text/x-vcard"".vda"="application/x-vda"".vdx"="application/vnd.visio"".vml"="text/xml"".vpg"="application/x-vpeg005" ".vsd"="application/vnd.visio"".vsd"="application/x-vsd"".vss"="application/vnd.visio"".vst"="application/vnd.visio"".vst"="application/x-vst"".vsw"="application/vnd.visio" ".vsx"="application/vnd.visio"".vtx"="application/vnd.visio"".vxml"="text/xml"".wav"="audio/wav"".wax"="audio/x-ms-wax"".wb1"="application/x-wb1"".wb2"="application/x-wb2"".wb3"="application/x-wb3"".wbmp"="image/vnd.wap.wbmp" ".wiz"="application/msword"".wk3"="application/x-wk3"".wk4"="application/x-wk4"".wkq"="application/x-wkq"".wks"="application/x-wks"".wm"="video/x-ms-wm"".wma"="audio/x-ms-wma"".wmd"="application/x-ms-wmd" ".wmf"="application/x-wmf"".wml"="text/vnd.wap.wml"".wmv"="video/x-ms-wmv"".wmx"="video/x-ms-wmx"".wmz"="application/x-ms-wmz" ".wp6"="application/x-wp6"".wpd"="application/x-wpd"".wpg"="application/x-wpg"".wpl"="application/vnd.ms-wpl" ".wq1"="application/x-wq1"".wr1"="application/x-wr1"".wri"="application/x-wri"".wrk"="application/x-wrk"".ws"="application/x-ws"".ws2"="application/x-ws"".wsc"="text/scriptlet"".wsdl"="text/xml"".wvx"="video/x-ms-wvx"".xdp"="application/vnd.adobe.xdp" ".xdr"="text/xml"".xfd"="application/vnd.adobe.xfd" ".xfdf"="application/vnd.adobe.xfdf" ".xhtml"="text/html"".xls"="application/vnd.ms-excel" ".xls"="application/x-xls"".xlw"="application/x-xlw"".xml"="text/xml"".xpl"="audio/scpls"".xq"="text/xml"".xql"="text/xml"".xquery"="text/xml"".xsd"="text/xml"".xsl"="text/xml"".xslt"="text/xml"".xwd"="application/x-xwd"".x_t"="application/x-x_t"。
各种类型文件的ContentType
各种类型⽂件的ContentType CONTENT_TYPE = {16'.load': 'text/html',17'.123': 'application/vnd.lotus-1-2-3',18'.3ds': 'image/x-3ds',19'.3g2': 'video/3gpp',20'.3ga': 'video/3gpp',21'.3gp': 'video/3gpp',22'.3gpp': 'video/3gpp',23'.602': 'application/x-t602',24'.669': 'audio/x-mod',25'.7z': 'application/x-7z-compressed',26'.a': 'application/x-archive',27'.aac': 'audio/mp4',28'.abw': 'application/x-abiword',29'.abw.crashed': 'application/x-abiword',30'.abw.gz': 'application/x-abiword',31'.ac3': 'audio/ac3',32'.ace': 'application/x-ace',33'.adb': 'text/x-adasrc',34'.ads': 'text/x-adasrc',35'.afm': 'application/x-font-afm',36'.ag': 'image/x-applix-graphics',37'.ai': 'application/illustrator',38'.aif': 'audio/x-aiff',39'.aifc': 'audio/x-aiff',40'.aiff': 'audio/x-aiff',41'.al': 'application/x-perl',42'.alz': 'application/x-alz',43'.amr': 'audio/amr',44'.ani': 'application/x-navi-animation',45'.anim[1-9j]': 'video/x-anim',46'.anx': 'application/annodex',47'.ape': 'audio/x-ape',48'.arj': 'application/x-arj',49'.arw': 'image/x-sony-arw',50'.as': 'application/x-applix-spreadsheet',51'.asc': 'text/plain',52'.asf': 'video/x-ms-asf',53'.asp': 'application/x-asp',54'.ass': 'text/x-ssa',55'.asx': 'audio/x-ms-asx',56'.atom': 'application/atom+xml',57'.au': 'audio/basic',58'.avi': 'video/x-msvideo',59'.aw': 'application/x-applix-word',60'.awb': 'audio/amr-wb',61'.awk': 'application/x-awk',62'.axa': 'audio/annodex',63'.axv': 'video/annodex',64'.bak': 'application/x-trash',65'.bcpio': 'application/x-bcpio',66'.bdf': 'application/x-font-bdf',67'.bib': 'text/x-bibtex',68'.bin': 'application/octet-stream',69'.blend': 'application/x-blender',70'.blender': 'application/x-blender',71'.bmp': 'image/bmp',72'.bz': 'application/x-bzip',73'.bz2': 'application/x-bzip',74'.c': 'text/x-csrc',75'.c++': 'text/x-c++src',76'.cab': 'application/vnd.ms-cab-compressed',77'.cb7': 'application/x-cb7',78'.cbr': 'application/x-cbr',79'.cbt': 'application/x-cbt',80'.cbz': 'application/x-cbz',81'.cc': 'text/x-c++src',82'.cdf': 'application/x-netcdf',83'.cdr': 'application/vnd.corel-draw',84'.cer': 'application/x-x509-ca-cert',85'.cert': 'application/x-x509-ca-cert',86'.cgm': 'image/cgm',87'.chm': 'application/x-chm',88'.chrt': 'application/x-kchart',89'.class': 'application/x-java',90'.cls': 'text/x-tex',97'.crw': 'image/x-canon-crw',98'.cs': 'text/x-csharp',99'.csh': 'application/x-csh',100'.css': 'text/css',101'.cssl': 'text/css',102'.csv': 'text/csv',103'.cue': 'application/x-cue',104'.cur': 'image/x-win-bitmap',105'.cxx': 'text/x-c++src',106'.d': 'text/x-dsrc',107'.dar': 'application/x-dar',108'.dbf': 'application/x-dbf',109'.dc': 'application/x-dc-rom',110'.dcl': 'text/x-dcl',111'.dcm': 'application/dicom',112'.dcr': 'image/x-kodak-dcr',113'.dds': 'image/x-dds',114'.deb': 'application/x-deb',115'.der': 'application/x-x509-ca-cert',116'.desktop': 'application/x-desktop',117'.dia': 'application/x-dia-diagram',118'.diff': 'text/x-patch',119'.divx': 'video/x-msvideo',120'.djv': 'image/vnd.djvu',121'.djvu': 'image/vnd.djvu',122'.dng': 'image/x-adobe-dng',123'.doc': 'application/msword',124'.docbook': 'application/docbook+xml',125'.docm': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 126'.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 127'.dot': 'text/vnd.graphviz',128'.dsl': 'text/x-dsl',129'.dtd': 'application/xml-dtd',130'.dtx': 'text/x-tex',131'.dv': 'video/dv',132'.dvi': 'application/x-dvi',133'.dvi.bz2': 'application/x-bzdvi',134'.dvi.gz': 'application/x-gzdvi',135'.dwg': 'image/vnd.dwg',136'.dxf': 'image/vnd.dxf',137'.e': 'text/x-eiffel',138'.egon': 'application/x-egon',139'.eif': 'text/x-eiffel',140'.el': 'text/x-emacs-lisp',141'.emf': 'image/x-emf',142'.emp': 'application/vnd.emusic-emusic_package',143'.ent': 'application/xml-external-parsed-entity',144'.eps': 'image/x-eps',145'.eps.bz2': 'image/x-bzeps',146'.eps.gz': 'image/x-gzeps',147'.epsf': 'image/x-eps',148'.epsf.bz2': 'image/x-bzeps',149'.epsf.gz': 'image/x-gzeps',150'.epsi': 'image/x-eps',151'.epsi.bz2': 'image/x-bzeps',152'.epsi.gz': 'image/x-gzeps',153'.epub': 'application/epub+zip',154'.erl': 'text/x-erlang',155'.es': 'application/ecmascript',156'.etheme': 'application/x-e-theme',157'.etx': 'text/x-setext',158'.exe': 'application/x-ms-dos-executable',159'.exr': 'image/x-exr',160'.ez': 'application/andrew-inset',161'.f': 'text/x-fortran',162'.f90': 'text/x-fortran',163'.f95': 'text/x-fortran',164'.fb2': 'application/x-fictionbook+xml',165'.fig': 'image/x-xfig',166'.fits': 'image/fits',167'.fl': 'application/x-fluid',168'.flac': 'audio/x-flac',169'.flc': 'video/x-flic',170'.fli': 'video/x-flic',171'.flv': 'video/x-flv',172'.flw': 'application/x-kivio',173'.fo': 'text/x-xslfo',174'.for': 'text/x-fortran',181'.gen': 'application/x-genesis-rom',182'.gf': 'application/x-tex-gf',183'.gg': 'application/x-sms-rom',184'.gif': 'image/gif',185'.glade': 'application/x-glade',186'.gmo': 'application/x-gettext-translation', 187'.gnc': 'application/x-gnucash',188'.gnd': 'application/gnunet-directory',189'.gnucash': 'application/x-gnucash',190'.gnumeric': 'application/x-gnumeric',191'.gnuplot': 'application/x-gnuplot',192'.gp': 'application/x-gnuplot',193'.gpg': 'application/pgp-encrypted',194'.gplt': 'application/x-gnuplot',195'.gra': 'application/x-graphite',196'.gsf': 'application/x-font-type1',197'.gsm': 'audio/x-gsm',198'.gtar': 'application/x-tar',199'.gv': 'text/vnd.graphviz',200'.gvp': 'text/x-google-video-pointer',201'.gz': 'application/x-gzip',202'.h': 'text/x-chdr',203'.h++': 'text/x-c++hdr',204'.hdf': 'application/x-hdf',205'.hh': 'text/x-c++hdr',206'.hp': 'text/x-c++hdr',207'.hpgl': 'application/vnd.hp-hpgl',208'.hpp': 'text/x-c++hdr',209'.hs': 'text/x-haskell',210'.htm': 'text/html',211'.html': 'text/html',212'.hwp': 'application/x-hwp',213'.hwt': 'application/x-hwt',214'.hxx': 'text/x-c++hdr',215'.ica': 'application/x-ica',216'.icb': 'image/x-tga',217'.icns': 'image/x-icns',218'.ico': 'image/vnd.microsoft.icon',219'.ics': 'text/calendar',220'.idl': 'text/x-idl',221'.ief': 'image/ief',222'.iff': 'image/x-iff',223'.ilbm': 'image/x-ilbm',224'.ime': 'text/x-imelody',225'.imy': 'text/x-imelody',226'.ins': 'text/x-tex',227'.iptables': 'text/x-iptables',228'.iso': 'application/x-cd-image',229'.iso9660': 'application/x-cd-image',230'.it': 'audio/x-it',231'.j2k': 'image/jp2',232'.jad': 'text/vnd.sun.j2me.app-descriptor', 233'.jar': 'application/x-java-archive',234'.java': 'text/x-java',235'.jng': 'image/x-jng',236'.jnlp': 'application/x-java-jnlp-file',237'.jp2': 'image/jp2',238'.jpc': 'image/jp2',239'.jpe': 'image/jpeg',240'.jpeg': 'image/jpeg',241'.jpf': 'image/jp2',242'.jpg': 'image/jpeg',243'.jpr': 'application/x-jbuilder-project',244'.jpx': 'image/jp2',245'.js': 'application/javascript',246'.json': 'application/json',247'.jsonp': 'application/jsonp',248'.k25': 'image/x-kodak-k25',249'.kar': 'audio/midi',250'.karbon': 'application/x-karbon',251'.kdc': 'image/x-kodak-kdc',252'.kdelnk': 'application/x-desktop',253'.kexi': 'application/x-kexiproject-sqlite3', 254'.kexic': 'application/x-kexi-connectiondata', 255'.kexis': 'application/x-kexiproject-shortcut', 256'.kfo': 'application/x-kformula',257'.kil': 'application/x-killustrator',258'.kino': 'application/smil',266'.ksp': 'application/x-kspread',267'.kud': 'application/x-kugar',268'.kwd': 'application/x-kword',269'.kwt': 'application/x-kword',270'.la': 'application/x-shared-library-la', 271'.latex': 'text/x-tex',272'.ldif': 'text/x-ldif',273'.lha': 'application/x-lha',274'.lhs': 'text/x-literate-haskell',275'.lhz': 'application/x-lhz',276'.log': 'text/x-log',277'.ltx': 'text/x-tex',278'.lua': 'text/x-lua',279'.lwo': 'image/x-lwo',280'.lwob': 'image/x-lwo',281'.lws': 'image/x-lws',282'.ly': 'text/x-lilypond',283'.lyx': 'application/x-lyx',284'.lz': 'application/x-lzip',285'.lzh': 'application/x-lha',286'.lzma': 'application/x-lzma',287'.lzo': 'application/x-lzop',288'.m': 'text/x-matlab',289'.m15': 'audio/x-mod',290'.m2t': 'video/mpeg',291'.m3u': 'audio/x-mpegurl',292'.m3u8': 'audio/x-mpegurl',293'.m4': 'application/x-m4',294'.m4a': 'audio/mp4',295'.m4b': 'audio/x-m4b',296'.m4v': 'video/mp4',297'.mab': 'application/x-markaby',298'.man': 'application/x-troff-man',299'.mbox': 'application/mbox',300'.md': 'application/x-genesis-rom',301'.mdb': 'application/vnd.ms-access', 302'.mdi': 'image/vnd.ms-modi',303'.me': 'text/x-troff-me',304'.med': 'audio/x-mod',305'.metalink': 'application/metalink+xml', 306'.mgp': 'application/x-magicpoint',307'.mid': 'audio/midi',308'.midi': 'audio/midi',309'.mif': 'application/x-mif',310'.minipsf': 'audio/x-minipsf',311'.mka': 'audio/x-matroska',312'.mkv': 'video/x-matroska',313'.ml': 'text/x-ocaml',314'.mli': 'text/x-ocaml',315'.mm': 'text/x-troff-mm',316'.mmf': 'application/x-smaf',317'.mml': 'text/mathml',318'.mng': 'video/x-mng',319'.mo': 'application/x-gettext-translation', 320'.mo3': 'audio/x-mo3',321'.moc': 'text/x-moc',322'.mod': 'audio/x-mod',323'.mof': 'text/x-mof',324'.moov': 'video/quicktime',325'.mov': 'video/quicktime',326'.movie': 'video/x-sgi-movie',327'.mp+': 'audio/x-musepack',328'.mp2': 'video/mpeg',329'.mp3': 'audio/mpeg',330'.mp4': 'video/mp4',331'.mpc': 'audio/x-musepack',332'.mpe': 'video/mpeg',333'.mpeg': 'video/mpeg',334'.mpg': 'video/mpeg',335'.mpga': 'audio/mpeg',336'.mpp': 'audio/x-musepack',337'.mrl': 'text/x-mrml',338'.mrml': 'text/x-mrml',339'.mrw': 'image/x-minolta-mrw',340'.ms': 'text/x-troff-ms',341'.msi': 'application/x-msi',342'.msod': 'image/x-msod',350'.nds': 'application/x-nintendo-ds-rom',351'.nef': 'image/x-nikon-nef',352'.nes': 'application/x-nes-rom',353'.nfo': 'text/x-nfo',354'.not': 'text/x-mup',355'.nsc': 'application/x-netshow-channel',356'.nsv': 'video/x-nsv',357'.o': 'application/x-object',358'.obj': 'application/x-tgif',359'.ocl': 'text/x-ocl',360'.oda': 'application/oda',361'.odb': 'application/vnd.oasis.opendocument.database',362'.odc': 'application/vnd.oasis.opendocument.chart',363'.odf': 'application/vnd.oasis.opendocument.formula',364'.odg': 'application/vnd.oasis.opendocument.graphics',365'.odi': 'application/vnd.oasis.opendocument.image',366'.odm': 'application/vnd.oasis.opendocument.text-master',367'.odp': 'application/vnd.oasis.opendocument.presentation',368'.ods': 'application/vnd.oasis.opendocument.spreadsheet',369'.odt': 'application/vnd.oasis.opendocument.text',370'.oga': 'audio/ogg',371'.ogg': 'video/x-theora+ogg',372'.ogm': 'video/x-ogm+ogg',373'.ogv': 'video/ogg',374'.ogx': 'application/ogg',375'.old': 'application/x-trash',376'.oleo': 'application/x-oleo',377'.opml': 'text/x-opml+xml',378'.ora': 'image/openraster',379'.orf': 'image/x-olympus-orf',380'.otc': 'application/vnd.oasis.opendocument.chart-template',381'.otf': 'application/x-font-otf',382'.otg': 'application/vnd.oasis.opendocument.graphics-template', 383'.oth': 'application/vnd.oasis.opendocument.text-web',384'.otp': 'application/vnd.oasis.opendocument.presentation-template', 385'.ots': 'application/vnd.oasis.opendocument.spreadsheet-template', 386'.ott': 'application/vnd.oasis.opendocument.text-template',387'.owl': 'application/rdf+xml',388'.oxt': 'application/vnd.openofficeorg.extension',389'.p': 'text/x-pascal',390'.p10': 'application/pkcs10',391'.p12': 'application/x-pkcs12',392'.p7b': 'application/x-pkcs7-certificates',393'.p7s': 'application/pkcs7-signature',394'.pack': 'application/x-java-pack200',395'.pak': 'application/x-pak',396'.par2': 'application/x-par2',397'.pas': 'text/x-pascal',398'.patch': 'text/x-patch',399'.pbm': 'image/x-portable-bitmap',400'.pcd': 'image/x-photo-cd',401'.pcf': 'application/x-cisco-vpn-settings',402'.pcf.gz': 'application/x-font-pcf',403'.pcf.z': 'application/x-font-pcf',404'.pcl': 'application/vnd.hp-pcl',405'.pcx': 'image/x-pcx',406'.pdb': 'chemical/x-pdb',407'.pdc': 'application/x-aportisdoc',408'.pdf': 'application/pdf',409'.pdf.bz2': 'application/x-bzpdf',410'.pdf.gz': 'application/x-gzpdf',411'.pef': 'image/x-pentax-pef',412'.pem': 'application/x-x509-ca-cert',413'.perl': 'application/x-perl',414'.pfa': 'application/x-font-type1',415'.pfb': 'application/x-font-type1',416'.pfx': 'application/x-pkcs12',417'.pgm': 'image/x-portable-graymap',418'.pgn': 'application/x-chess-pgn',419'.pgp': 'application/pgp-encrypted',420'.php': 'application/x-php',421'.php3': 'application/x-php',422'.php4': 'application/x-php',423'.pict': 'image/x-pict',424'.pict1': 'image/x-pict',425'.pict2': 'image/x-pict',426'.pickle': 'application/python-pickle',433'.pls': 'audio/x-scpls',434'.pm': 'application/x-perl',435'.png': 'image/png',436'.pnm': 'image/x-portable-anymap',437'.pntg': 'image/x-macpaint',438'.po': 'text/x-gettext-translation',439'.por': 'application/x-spss-por',440'.pot': 'text/x-gettext-translation-template',441'.ppm': 'image/x-portable-pixmap',442'.pps': 'application/vnd.ms-powerpoint',443'.ppt': 'application/vnd.ms-powerpoint',444'.pptm': 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 445'.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 446'.ppz': 'application/vnd.ms-powerpoint',447'.prc': 'application/x-palm-database',448'.ps': 'application/postscript',449'.ps.bz2': 'application/x-bzpostscript',450'.ps.gz': 'application/x-gzpostscript',451'.psd': 'image/vnd.adobe.photoshop',452'.psf': 'audio/x-psf',453'.psf.gz': 'application/x-gz-font-linux-psf',454'.psflib': 'audio/x-psflib',455'.psid': 'audio/prs.sid',456'.psw': 'application/x-pocket-word',457'.pw': 'application/x-pw',458'.py': 'text/x-python',459'.pyc': 'application/x-python-bytecode',460'.pyo': 'application/x-python-bytecode',461'.qif': 'image/x-quicktime',462'.qt': 'video/quicktime',463'.qtif': 'image/x-quicktime',464'.qtl': 'application/x-quicktime-media-link',465'.qtvr': 'video/quicktime',466'.ra': 'audio/vnd.rn-realaudio',467'.raf': 'image/x-fuji-raf',468'.ram': 'application/ram',469'.rar': 'application/x-rar',470'.ras': 'image/x-cmu-raster',471'.raw': 'image/x-panasonic-raw',472'.rax': 'audio/vnd.rn-realaudio',473'.rb': 'application/x-ruby',474'.rdf': 'application/rdf+xml',475'.rdfs': 'application/rdf+xml',476'.reg': 'text/x-ms-regedit',477'.rej': 'application/x-reject',478'.rgb': 'image/x-rgb',479'.rle': 'image/rle',480'.rm': 'application/vnd.rn-realmedia',481'.rmj': 'application/vnd.rn-realmedia',482'.rmm': 'application/vnd.rn-realmedia',483'.rms': 'application/vnd.rn-realmedia',484'.rmvb': 'application/vnd.rn-realmedia',485'.rmx': 'application/vnd.rn-realmedia',486'.roff': 'text/troff',487'.rp': 'image/vnd.rn-realpix',488'.rpm': 'application/x-rpm',489'.rss': 'application/rss+xml',490'.rt': 'text/vnd.rn-realtext',491'.rtf': 'application/rtf',492'.rtx': 'text/richtext',493'.rv': 'video/vnd.rn-realvideo',494'.rvx': 'video/vnd.rn-realvideo',495'.s3m': 'audio/x-s3m',496'.sam': 'application/x-amipro',497'.sami': 'application/x-sami',498'.sav': 'application/x-spss-sav',499'.scm': 'text/x-scheme',500'.sda': 'application/vnd.stardivision.draw',501'.sdc': 'application/vnd.stardivision.calc',502'.sdd': 'application/vnd.stardivision.impress',503'.sdp': 'application/sdp',504'.sds': 'application/vnd.stardivision.chart',505'.sdw': 'application/vnd.stardivision.writer',506'.sgf': 'application/x-go-sgf',507'.sgi': 'image/x-sgi',508'.sgl': 'application/vnd.stardivision.writer',509'.sgm': 'text/sgml',510'.sgml': 'text/sgml',516'.sik': 'application/x-trash',517'.sis': 'application/vnd.symbian.install',518'.sisx': 'x-epoc/x-sisx-app',519'.sit': 'application/x-stuffit',520'.siv': 'application/sieve',521'.sk': 'image/x-skencil',522'.sk1': 'image/x-skencil',523'.skr': 'application/pgp-keys',524'.slk': 'text/spreadsheet',525'.smaf': 'application/x-smaf',526'.smc': 'application/x-snes-rom',527'.smd': 'application/vnd.stardivision.mail',528'.smf': 'application/vnd.stardivision.math',529'.smi': 'application/x-sami',530'.smil': 'application/smil',531'.sml': 'application/smil',532'.sms': 'application/x-sms-rom',533'.snd': 'audio/basic',534'.so': 'application/x-sharedlib',535'.spc': 'application/x-pkcs7-certificates',536'.spd': 'application/x-font-speedo',537'.spec': 'text/x-rpm-spec',538'.spl': 'application/x-shockwave-flash',539'.spx': 'audio/x-speex',540'.sql': 'text/x-sql',541'.sr2': 'image/x-sony-sr2',542'.src': 'application/x-wais-source',543'.srf': 'image/x-sony-srf',544'.srt': 'application/x-subrip',545'.ssa': 'text/x-ssa',546'.stc': 'application/vnd.sun.xml.calc.template', 547'.std': 'application/vnd.sun.xml.draw.template', 548'.sti': 'application/vnd.sun.xml.impress.template', 549'.stm': 'audio/x-stm',550'.stw': 'application/vnd.sun.xml.writer.template', 551'.sty': 'text/x-tex',552'.sub': 'text/x-subviewer',553'.sun': 'image/x-sun-raster',554'.sv4cpio': 'application/x-sv4cpio',555'.sv4crc': 'application/x-sv4crc',556'.svg': 'image/svg+xml',557'.svgz': 'image/svg+xml-compressed',558'.swf': 'application/x-shockwave-flash',559'.sxc': 'application/vnd.sun.xml.calc',560'.sxd': 'application/vnd.sun.xml.draw',561'.sxg': 'application/vnd.sun.xml.writer.global', 562'.sxi': 'application/vnd.sun.xml.impress',563'.sxm': 'application/vnd.sun.xml.math',564'.sxw': 'application/vnd.sun.xml.writer',565'.sylk': 'text/spreadsheet',566'.t': 'text/troff',567'.t2t': 'text/x-txt2tags',568'.tar': 'application/x-tar',569'.tar.bz': 'application/x-bzip-compressed-tar', 570'.tar.bz2': 'application/x-bzip-compressed-tar', 571'.tar.gz': 'application/x-compressed-tar',572'.tar.lzma': 'application/x-lzma-compressed-tar', 573'.tar.lzo': 'application/x-tzo',574'.tar.xz': 'application/x-xz-compressed-tar',575'.tar.z': 'application/x-tarz',576'.tbz': 'application/x-bzip-compressed-tar',577'.tbz2': 'application/x-bzip-compressed-tar',578'.tcl': 'text/x-tcl',579'.tex': 'text/x-tex',580'.texi': 'text/x-texinfo',581'.texinfo': 'text/x-texinfo',582'.tga': 'image/x-tga',583'.tgz': 'application/x-compressed-tar',584'.theme': 'application/x-theme',585'.themepack': 'application/x-windows-themepack', 586'.tif': 'image/tiff',587'.tiff': 'image/tiff',588'.tk': 'text/x-tcl',589'.tlz': 'application/x-lzma-compressed-tar',590'.tnef': 'application/vnd.ms-tnef',591'.tnf': 'application/vnd.ms-tnef',592'.toc': 'application/x-cdrdao-toc',593'.torrent': 'application/x-bittorrent',594'.tpic': 'image/x-tga',。
office所有后缀对应的content-type
登录后才能查看或发表评论立即登录或者逛逛博客园首页
ype
后缀 MIME Type .doc application/msword .dot application/msword .docx application/vnd.openxmlformats-officedocument.wordprocessingml.document .dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template .docm application/vnd.ms-word.document.macroEnabled.12 .dotm application/vnd.ms-word.template.macroEnabled.12 .xls application/vnd.ms-excel .xlt application/vnd.ms-excel .xla application/vnd.ms-excel .xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template .xlsm application/vnd.ms-excel.sheet.macroEnabled.12 .xltm application/vnd.ms-excel.template.macroEnabled.12 .xlam application/vnd.ms-excel.addin.macroEnabled.12 .xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12 .ppt application/vnd.ms-powerpoint .pot application/vnd.ms-powerpoint .pps application/vnd.ms-powerpoint .ppa application/vnd.ms-powerpoint .pptx application/vnd.openxmlformats-officedocument.presentationml.presentation .potx application/vnd.openxmlformats-officedocument.presentationml.template .ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow .ppam application/vnd.ms-powerpoint.addin.macroEnabled.12 .pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12 .potm application/vnd.ms-powerpoint.presentation.macroEnabled.12 .ppsm application/vnd.ms-powerpoint.slideshow.macroEnabled.12
office文件所对应的的Content-type类型总结
office⽂件所对应的的Content-type类型总结最近做⽂件下载因为涉及到不同类型的⽂件,所以重新查阅了⼀下⽂件所对应的的content-type类型,好记性不如烂笔头,记录⼀下。
⽂件后缀MIME TYPE.doc application/msword.dot application/msword.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document.dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template.docm application/vnd.ms-word.document.macroEnabled.12.dotm application/vnd.ms-word.template.macroEnabled.12.xls application/vnd.ms-excel.xlt application/vnd.ms-excel.xla application/vnd.ms-excel.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template.xlsm application/vnd.ms-excel.sheet.macroEnabled.12.xltm application/vnd.ms-excel.template.macroEnabled.12.xlam application/vnd.ms-excel.addin.macroEnabled.12.xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12.ppt application/vnd.ms-powerpoint.pot application/vnd.ms-powerpoint.pps application/vnd.ms-powerpoint.ppa application/vnd.ms-powerpoint.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation.potx application/vnd.openxmlformats-officedocument.presentationml.template.ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow.ppam application/vnd.ms-powerpoint.addin.macroEnabled.12.pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12.potm application/vnd.ms-powerpoint.presentation.macroEnabled.12.ppsm application/vnd.ms-powerpoint.slideshow.macroEnabled.12.zip application/zip.tar application/x-tar接下来再补充⼀下基础知识什么是 Content-typeContent-type是实体⾸部字段,⽤于说明请求或返回的消息是⽤什么格式进⾏编码的,在request header和response header⾥都有存在。
HTTP中Content-type对照表
HTTP Content-type 对照表Content-Type,内容类型,一般是指网页中存在的Content-Type,用于定义网络文件的类型和网页的编码,决定浏览器将以什么形式、什么编码读取这个文件,比如用PHP输出图片文件、JSON数据、XML文件等非HTML内容时,就必须用header函数来指定Content-Type,才能达到输出一张图片或是其它指定内容类型的需求。
Application Type文件扩展名Content-Type(Mime-Type)描述.application/x-.*application/octet-stream 二进制流,不知道下载文件类型.pdf application/pdf PDF(Portable Document Format的简称,意为“便携式文件格式”).ai application/postscript PostScript(PS)是主要用于电子产业和桌面出版领域的一种页面描述语言和编程语言。
.xml application/atom+xml Atom feeds.js application/ecmascript 相当于application/javascript 但是严格的处理规则.edi application/EDI-X12EDI ANSI ASC X12数据.edi application/EDIFACT EDI EDIFACT数据.json application/json JSON(JavaScript Object Notation).js application/javascript ECMAScript/JavaScript (相当于application/ecmascript 但是宽松的处理规则).ogg application/ogg Ogg, 视频文件格式.rdf application/rdf+xml 资源描述框架(Resource Description Framework,缩写 RDF),是万维网联盟(W3C)提出的一组标记语言的技术标准,以便更为丰富地描述和表达网络.application/x-资源的内容与结构。
Content-type的说明即HTTP请求头的类型整理
Content-type的说明即HTTP请求头的类型整理要学习content-type,必须事先知道它到底是什么,是⼲什么⽤的。
HTTP协议(RFC2616)采⽤了请求/响应模型。
客户端向服务器发送⼀个请求,请求头包含请求的⽅法、URI、协议版本、以及包含请求修饰符、客户信息和内容的类似于MIME的消息结构。
服务器以⼀个状态⾏作为响应,相应的内容包括消息协议的版本,成功或者错误编码加上包含服务器信息、实体元信息以及可能的实体内容。
通常HTTP消息由⼀个起始⾏,⼀个或者多个头域,⼀个只是头域结束的空⾏和可选的消息体组成。
HTTP的头域包括通⽤头,请求头,响应头和实体头四个部分。
每个头域由⼀个域名,冒号(:)和域值三部分组成。
域名是⼤⼩写⽆关的,域值前可以添加任何数量的空格符,头域可以被扩展为多⾏,在每⾏开始处,使⽤⾄少⼀个空格或制表符。
请求消息和响应消息都可以包含实体信息,实体信息⼀般由实体头域和实体组成。
实体头域包含关于实体的原信息,实体头包括Allow、Content- Base、Content-Encoding、Content-Language、 Content-Length、Content-Location、Content-MD5、Content-Range、Content-Type、 Etag、Expires、Last-Modified、extension-header。
Content-Type是返回消息中⾮常重要的内容,表⽰后⾯的⽂档属于什么MIME类型。
Content-Type: [type]/[subtype]; parameter。
例如最常见的就是text/html,它的意思是说返回的内容是⽂本类型,这个⽂本⼜是HTML格式的。
原则上浏览器会根据Content-Type来决定如何显⽰返回的消息体内容。
type有下⾯的形式Text:⽤于标准化地表⽰的⽂本信息,⽂本消息可以是多种字符集和或者多种格式的;Multipart:⽤于连接消息体的多个部分构成⼀个消息,这些部分可以是不同类型的数据;Application:⽤于传输应⽤程序数据或者⼆进制数据;Message:⽤于包装⼀个E-mail消息;Image:⽤于传输静态图⽚数据;Audio:⽤于传输⾳频或者⾳声数据;Video:⽤于传输动态影像数据,可以是与⾳频编辑在⼀起的视频数据格式。
contenttype正则
contenttype正则对于开发人员来说,使用正则表达式是一项重要的技能。
其中一个常见的用途是检测和解析HTTP请求中的Content-Type头部。
Content-Type是HTTP请求头部的一部分,用于指定请求或响应中所使用的媒体类型。
它定义了请求或响应中所传输的数据的类型和格式。
常见的Content-Type值包括"application/json"、"text/html"和"image/jpeg"等。
为了在HTTP请求中提取Content-Type头部的值,我们可以使用正则表达式。
下面是一个示例正则表达式,用于匹配Content-Type头部中的值:```Content-Type:\s*(.*)```这个正则表达式的含义是:以"Content-Type:"开头,后面跟着任意数量的空白字符,并进行零次或多次匹配。
接下来,使用捕获组捕获Content-Type的值。
下面是一个示例代码,演示如何使用正则表达式提取Content-Type头部的值:```pythonimport reheader = "Content-Type: application/json"pattern = r"Content-Type:\s*(.*)"matches = re.findall(pattern, header)if matches:content_type = matches[0]print(content_type)```在上述代码中,我们首先定义了一个字符串变量"header",其中包含了一个Content-Type头部的示例值。
然后,我们使用re模块的findall函数,并传递正则表达式和header作为参数。
findall函数将返回一个匹配正则表达式的所有结果的列表。
HttpHeader里的Content-Type
HttpHeader⾥的Content-Type之前⼀直分不清楚post请求⾥Content-Type⽅式,如application/x-www-form-urlencoded、multipart/form-data。
本⽂会介绍Content-Type有哪⼏种、插件Postman和RESTClient使⽤⽰例。
⽂末还会介绍在PHP中CURL⾥需要注意的细节。
简介Http Header⾥的Content-Type⼀般有这三种:application/x-www-form-urlencoded:数据被编码为名称/值对。
这是标准的编码格式。
multipart/form-data: 数据被编码为⼀条消息,页上的每个控件对应消息中的⼀个部分。
text/plain: 数据以纯⽂本形式(text/json/xml/html)进⾏编码,其中不含任何控件或格式字符。
postman软件⾥标的是RAW。
form的enctype属性为编码⽅式,常⽤有两种:application/x-www-form-urlencoded和multipart/form-data,默认为application/x-www-form-urlencoded。
当action为get时候,浏览器⽤x-www-form-urlencoded的编码⽅式把form数据转换成⼀个字串(name1=value1&name2=value2...),然后把这个字串追加到url后⾯,⽤?分割,加载这个新的url。
当action为post时候,浏览器把form数据封装到http body中,然后发送到server。
如果没有type=file的控件,⽤默认的application/x-www-form-urlencoded就可以了。
但是如果有type=file的话,就要⽤到multipart/form-data了。
当action为post且Content-Type类型是multipart/form-data,浏览器会把整个表单以控件为单位分割,并为每个部分加上Content-Disposition(form-data或者file),Content-Type(默认为text/plain),name(控件name)等信息,并加上分割符(boundary)。
js下载doxc文件示例和部分后缀对应的content-type总结
js下载doxc⽂件⽰例和部分后缀对应的content-type总结⽰例⼀:下载docx ⽂件,后台返回⽂件流1. 设置响应类型resonseType (blob 或者arraybuffer)axios.get(url,{resonseType:'blob'})2. 根据返回值(⽂件流)创建blob 对象,并指定type⽂件类型 (doxc 为例)let resData = new Blob([res.data],{type:'application/vnd.openxmlformats-officedocument.wordprocessingml.document'})3. 使⽤ URL.createObjectURL 创建⼀个url 链接let dowLink= URL.createObjectURL(resData)4. 创建⼀个a 标签type 为download,进⾏下载var aDom = document.createElement("a");aDom.setAttribute('style', 'display:none');aDom.setAttribute('href', dowLink);aDom.setAttribute('download', filename+".docx");document.body.appendChild(aDom);aDom.click();URL.revokeObjectURL(dowLink);document.body.removeChild(aDom);⽰例⼆:⽣成base64 图⽚(后台返回数据流)axios.get(url, { responseType: 'arraybuffer'}).then(response=>{ let imgSrc ='data:image/png;base64,' + btoa(new Uint8Array(response.data).reduce((data, byte) => data + String.fromCharCode(byte), ''));})⼆:部分后缀对应的content-type后缀MIME Type.323text/h323.3g2video/3gpp2.3gp video/3gpp.3gp2video/3gpp2.3gpp video/3gpp.7z application/x-7z-compressed.aa audio/audible.AAC audio/aac.aaf application/octet-stream.aax audio/vnd.audible.aax.ac3audio/ac3.aca application/octet-stream.accda application/msaccess.addin.accdb application/msaccess.accdc application/msaccess.cab.accde application/msaccess.accdr application/msaccess.runtime.accdt application/msaccess.accdw application/msaccess.webapplication.accft application/msaccess.ftemplate后缀MIME Type.acx application/internet-property-stream.AddIn text/xml.ade application/msaccess.adobebridge application/x-bridge-url.adp application/msaccess.ADT audio/vnd.dlna.adts.ADTS audio/aac.afm application/octet-stream.ai application/postscript.aif audio/x-aiff.aifc audio/aiff.aiff audio/aiff.air application/vnd.adobe.air-application-installer-package+zip .amc application/x-mpeg.application application/x-ms-application.art image/x-jg.asa application/xml.asax application/xml.ascx application/xml.asd application/octet-stream.asf video/x-ms-asf.ashx application/xml.asi application/octet-stream.asm text/plain.asmx application/xml.aspx application/xml.asr video/x-ms-asf.asx video/x-ms-asf.atom application/atom+xml.au audio/basic.avi video/x-msvideo.axs application/olescript.bas text/plain.bcpio application/x-bcpio.bin application/octet-stream.bmp image/bmp.c text/plain.cab application/octet-stream.caf audio/x-caf.calx application/vnd.ms-office.calx.cat application/vnd.ms-pki.seccat.cc text/plain.cd text/plain.cdda audio/aiff.cdf application/x-cdf.cer application/x-x509-ca-cert.chm application/octet-stream.class application/x-java-applet.clp application/x-msclip.cmx image/x-cmx.cnf text/plain.cod image/cis-cod.config application/xml.contact text/x-ms-contact.coverage application/xml.cpio application/x-cpio.cpp text/plain.cpp text/plain后缀MIME Type.crd application/x-mscardfile.crl application/pkix-crl.crt application/x-x509-ca-cert.cs text/plain.csdproj text/plain.csh application/x-csh.csproj text/plain.css text/css.csv text/csv.cur application/octet-stream.cxx text/plain.dat application/octet-stream.datasource application/xml.dbproj text/plain.dcr application/x-director.def text/plain.deploy application/octet-stream.der application/x-x509-ca-cert.dgml application/xml.dib image/bmp.dif video/x-dv.dir application/x-director.disco text/xml.dll application/x-msdownload.dll.config text/xml.dlm text/dlm.doc application/msword.docm application/vnd.ms-word.document.macroEnabled.12.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document .dot application/msword.dotm application/vnd.ms-word.template.macroEnabled.12.dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template .dsp application/octet-stream.dsw text/plain.dtd text/xml.dtsConfig text/xml.dv video/x-dv.dvi application/x-dvi.dwf drawing/x-dwf.dwp application/octet-stream.dxr application/x-director.eml message/rfc822.emz application/octet-stream.eot application/octet-stream.eps application/postscript.etl application/etl.etx text/x-setext.evy application/envoy.exe application/octet-stream.exe.config text/xml.fdf application/vnd.fdf.fif application/fractals.filters Application/xml.fla application/octet-stream.flr x-world/x-vrml.flv video/x-flv.fsscript application/fsharp-script后缀MIME Type.fsx application/fsharp-script.generictest application/xml.gif image/gif.group text/x-ms-group.gsm audio/x-gsm.gtar application/x-gtar.gz application/x-gzip.h text/plain.hdf application/x-hdf.hdml text/x-hdml.hhc application/x-oleobject.hhk application/octet-stream.hhp application/octet-stream.hlp application/winhlp.hpp text/plain.hqx application/mac-binhex40 .hta application/hta.htc text/x-component.htm text/html.html text/html.htt text/webviewhtml.hxa application/xml.hxc application/xml.hxd application/octet-stream.hxe application/xml.hxf application/xml.hxh application/octet-stream.hxi application/octet-stream.hxk application/xml.hxq application/octet-stream.hxr application/octet-stream.hxs application/octet-stream.hxt text/html.hxv application/xml.hxw application/octet-stream.hxx text/plain.i text/plain.ico image/x-icon.ics application/octet-stream.idl text/plain.ief image/ief.iii application/x-iphone.inc text/plain.inf application/octet-stream.inl text/plain.ins application/x-internet-signup .ipa application/x-itunes-ipa.ipg application/x-itunes-ipg.ipproj text/plain.ipsw application/x-itunes-ipsw.iqy text/x-ms-iqy.isp application/x-internet-signup .ite application/x-itunes-ite.itlp application/x-itunes-itlp.itms application/x-itunes-itms.itpc application/x-itunes-itpc.itpc application/x-itunes-itpc .IVF video/x-ivf.jar application/java-archive .java application/octet-stream .jck application/liquidmotion .jcz application/liquidmotion .jfif image/pjpeg.jnlp application/x-java-jnlp-file .jpb application/octet-stream .jpe image/jpeg .jpeg image/jpeg .jpg image/jpeg.js application/x-javascript .jsx text/jscript .jsxbin text/plain.latex application/x-latex.library-ms application/windows-library+xml .lit application/x-ms-reader .loadtest application/xml .lpk application/octet-stream .lsf video/x-la-asf .lst text/plain .lsx video/x-la-asf.lzh application/octet-stream .m13application/x-msmediaview .m14application/x-msmediaview .m1v video/mpeg.m2t video/vnd.dlna.mpeg-tts .m2ts video/vnd.dlna.mpeg-tts .m2v video/mpeg .m3u audio/x-mpegurl .m3u8audio/x-mpegurl .m4a audio/m4a .m4b audio/m4b .m4p audio/m4p .m4r audio/x-m4r .m4v video/x-m4v .mac image/x-macpaint .mak text/plain.man application/x-troff-man .manifest application/x-ms-manifest .map text/plain .master application/xml .mda application/msaccess .mdb application/x-msaccess .mde application/msaccess .mdp application/octet-stream .me application/x-troff-me.mfp application/x-shockwave-flash .mht message/rfc822.mhtml message/rfc822.mid audio/mid .midi audio/mid.mix application/octet-stream .mk text/plain.mmf application/x-smaf .mno text/xml.mnyapplication/x-msmoney后缀MIME Type121454sdfsdfdsf.mny application/x-msmoney后缀MIME Type.mod video/mpeg.mov video/quicktime.movie video/x-sgi-movie.mp2video/mpeg.mp2v video/mpeg.mp3audio/mpeg.mp4video/mp4.mp4v video/mp4.mpa video/mpeg.mpe video/mpeg.mpeg video/mpeg.mpf application/vnd.ms-mediapackage.mpg video/mpeg.mpp application/vnd.ms-project.mpv2video/mpeg.mqv video/quicktime.ms application/x-troff-ms.msi application/octet-stream.mso application/octet-stream.mts video/vnd.dlna.mpeg-tts.mtx application/xml.mvb application/x-msmediaview.mvc application/x-miva-compiled.mxp application/x-mmxp.nc application/x-netcdf.nsc video/x-ms-asf.nws message/rfc822.ocx application/octet-stream.oda application/oda.odc text/x-ms-odc.odh text/plain.odl text/plain.odp application/vnd.oasis.opendocument.presentation .ods application/oleobject.odt application/vnd.oasis.opendocument.text.one application/onenote.onea application/onenote.onepkg application/onenote.onetmp application/onenote.onetoc application/onenote.onetoc2application/onenote.orderedtest application/xml.osdx application/opensearchdescription+xml.p10application/pkcs10.p12application/x-pkcs12.p7b application/x-pkcs7-certificates.p7c application/pkcs7-mime.p7m application/pkcs7-mime.p7r application/x-pkcs7-certreqresp.p7s application/pkcs7-signature.pbm image/x-portable-bitmap.pcast application/x-podcast.pct image/pict.pcx application/octet-stream.pcz application/octet-stream.pdf application/pdf.pfb application/octet-stream.pfb application/octet-stream后缀MIME Type.pfm application/octet-stream.pfx application/x-pkcs12.pgm image/x-portable-graymap.pic image/pict.pict image/pict.pkgdef text/plain.pkgundef text/plain.pko application/vnd.ms-pki.pko.pls audio/scpls.pma application/x-perfmon.pmc application/x-perfmon.pml application/x-perfmon.pmr application/x-perfmon.pmw application/x-perfmon.png image/png.pnm image/x-portable-anymap.pnt image/x-macpaint.pntg image/x-macpaint.pnz image/png.pot application/vnd.ms-powerpoint.potm application/vnd.ms-powerpoint.template.macroEnabled.12.potx application/vnd.openxmlformats-officedocument.presentationml.template.ppa application/vnd.ms-powerpoint.ppam application/vnd.ms-powerpoint.addin.macroEnabled.12.ppm image/x-portable-pixmap.pps application/vnd.ms-powerpoint.ppsm application/vnd.ms-powerpoint.slideshow.macroEnabled.12.ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow .ppt application/vnd.ms-powerpoint.pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation .prf application/pics-rules.prm application/octet-stream.prx application/octet-stream.ps application/postscript.psc1application/PowerShell.psd application/octet-stream.psess application/xml.psm application/octet-stream.psp application/octet-stream.pub application/x-mspublisher.pwz application/vnd.ms-powerpoint.qht text/x-html-insertion.qhtm text/x-html-insertion.qt video/quicktime.qti image/x-quicktime.qtif image/x-quicktime.qtl application/x-quicktimeplayer.qxd application/octet-stream.ra audio/x-pn-realaudio.ram audio/x-pn-realaudio.rar application/octet-stream.ras image/x-cmu-raster.rat application/rat-file.rc text/plain.rc2text/plain.rct text/plain后缀MIME Type.rdlc application/xml.resx application/xml.rf image/vnd.rn-realflash.rgb image/x-rgb.rgs text/plain.rm application/vnd.rn-realmedia.rmi audio/mid.rmp application/vnd.rn-rn_music_package.roff application/x-troff.rpm audio/x-pn-realaudio-plugin.rqy text/x-ms-rqy.rtf application/rtf.rtx text/richtext.ruleset application/xml.s text/plain.safariextz application/x-safari-safariextz.scd application/x-msschedule.sct text/scriptlet.sd2audio/x-sd2.sdp application/sdp.sea application/octet-stream.searchConnector-ms application/windows-search-connector+xml.setpay application/set-payment-initiation.setreg application/set-registration-initiation.settings application/xml.sgimb application/x-sgimb.sgml text/sgml.sh application/x-sh.shar application/x-shar.shtml text/html.sit application/x-stuffit.sitemap application/xml.skin application/xml.sldm application/vnd.ms-powerpoint.slide.macroEnabled.12.sldx application/vnd.openxmlformats-officedocument.presentationml.slide .slk application/vnd.ms-excel.sln text/plain.slupkg-ms application/x-ms-license.smd audio/x-smd.smi application/octet-stream.smx audio/x-smd.smz audio/x-smd.snd audio/basic.snippet application/xml.snp application/octet-stream.sol text/plain.sor text/plain.spc application/x-pkcs7-certificates.spl application/futuresplash.src application/x-wais-source.srf text/plain.SSISDeploymentManifest text/xml.ssm application/streamingmedia.sst application/vnd.ms-pki.certstore.stl application/vnd.ms-pki.stl.sv4cpio application/x-sv4cpio.sv4crc application/x-sv4crc.sv4crc application/x-sv4crc后缀MIME Type.svc application/xml.swf application/x-shockwave-flash .t application/x-troff.tar application/x-tar.tcl application/x-tcl.testrunconfig application/xml.testsettings application/xml.tex application/x-tex.texi application/x-texinfo.texinfo application/x-texinfo.tgz application/x-compressed.thmx application/vnd.ms-officetheme .thn application/octet-stream.tif image/tiff.tiff image/tiff.tlh text/plain.tli text/plain.toc application/octet-stream.tr application/x-troff.trm application/x-msterminal.trx application/xml.ts video/vnd.dlna.mpeg-tts.tsv text/tab-separated-values.ttf application/octet-stream.tts video/vnd.dlna.mpeg-tts.txt text/plain.u32application/octet-stream.uls text/iuls.user text/plain.ustar application/x-ustar.vb text/plain.vbdproj text/plain.vbk video/mpeg.vbproj text/plain.vbs text/vbscript.vcf text/x-vcard.vcproj Application/xml.vcs text/plain.vcxproj Application/xml.vddproj text/plain.vdp text/plain.vdproj text/plain.vdx application/vnd.ms-visio.viewer .vml text/xml.vscontent application/xml.vsct text/xml.vsd application/vnd.visio.vsi application/ms-vsi.vsix application/vsix.vsixlangpack text/xml.vsixmanifest text/xml.vsmdi application/xml.vspscc text/plain.vss application/vnd.visio.vsscc text/plain.vssettings text/xml.vssscc text/plain后缀MIME Type.vst application/vnd.visio.vstemplate text/xml.vsto application/x-ms-vsto.vsw application/vnd.visio.vsx application/vnd.visio.vtx application/vnd.visio.wav audio/wav.wave audio/wav.wax audio/x-ms-wax.wbk application/msword.wbmp image/vnd.wap.wbmp.wcm application/vnd.ms-works.wdb application/vnd.ms-works.wdp image/vnd.ms-photo.webarchive application/x-safari-webarchive.webtest application/xml.wiq application/xml.wiz application/msword.wks application/vnd.ms-works.WLMP application/wlmoviemaker.wlpginstall application/x-wlpg-detect.wlpginstall3application/x-wlpg3-detect.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.wmp video/x-ms-wmp.wmv video/x-ms-wmv.wmx video/x-ms-wmx.wmz application/x-ms-wmz.wpl application/vnd.ms-wpl.wps application/vnd.ms-works.wri application/x-mswrite.wrl x-world/x-vrml.wrz x-world/x-vrml.wsc text/scriptlet.wsdl text/xml.wvx video/x-ms-wvx.x application/directx.xaf x-world/x-vrml.xaml application/xaml+xml.xap application/x-silverlight-app.xbap application/x-ms-xbap.xbm image/x-xbitmap.xdr text/plain.xht application/xhtml+xml.xhtml application/xhtml+xml.xla application/vnd.ms-excel.xlam application/vnd.ms-excel.addin.macroEnabled.12 .xlc application/vnd.ms-excel.xld application/vnd.ms-excel.xlk application/vnd.ms-excel.xlk application/vnd.ms-excel后缀MIME Type.xll application/vnd.ms-excel.xlm application/vnd.ms-excel.xls application/vnd.ms-excel.xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12.xlsm application/vnd.ms-excel.sheet.macroEnabled.12.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlt application/vnd.ms-excel.xltm application/vnd.ms-excel.template.macroEnabled.12.xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template .xlw application/vnd.ms-excel.xml text/xml.xmta application/xml.xof x-world/x-vrml.XOML text/plain.xpm image/x-xpixmap.xps application/vnd.ms-xpsdocument.xrm-ms text/xml.xsc application/xml.xsd text/xml.xsf text/xml.xsl text/xml.xslt text/xml.xsn application/octet-stream.xss application/xml.xtp application/octet-stream.xwd image/x-xwindowdump.z application/x-compress.zip application/x-zip-compressed。
contenttype mime类型
MIME(Multipurpose Internet Mail Extensions)类型,也称为媒体类型,是用于标识在互联网上传输的多媒体数据的一种标准。
每种MIME 类型都由两部分组成:主类型(Top-Level Type)和子类型(Subtype)。
MIME 类型通常以"主类型/子类型" 的格式表示,例如"text/html" 或"image/jpeg"。
以下是一些常见的MIME 类型示例及其描述:text/plain:普通文本类型,用于纯文本数据,不包含格式或特殊样式。
text/html:HTML 文档类型,用于表示网页内容。
application/json:JSON 数据类型,用于表示结构化的数据。
application/xml:XML 数据类型,用于表示标记语言中的结构化数据。
image/jpeg:JPEG 图像类型,用于表示图像文件。
image/png:PNG 图像类型,用于表示无损压缩的图像文件。
audio/mpeg:MPEG 音频类型,用于表示音频文件。
video/mp4:MP4 视频类型,用于表示视频文件。
application/pdf:PDF 文档类型,用于表示可移植文档格式。
application/octet-stream:通用的二进制数据类型,用于表示未知或不常见的二进制数据。
这些仅仅是众多可能的MIME 类型示例中的一部分。
每种MIME 类型都有特定的用途,有助于确保在互联网上传输的数据能够正确地被解释和处理。
在Web 开发中,设置正确的MIME 类型对于确保浏览器能够正确渲染内容非常重要。
常见文件后缀名和Content-type/mimetype对应关系
常见⽂件后缀名和Content-type/mimetype对应关系⽂件后缀名 对于mime type'apk' 'application/vnd.android.package-archive','3gp' 'video/3gpp','ai' 'application/postscript','aif' 'audio/x-aiff','aifc' 'audio/x-aiff','aiff' 'audio/x-aiff','asc' 'text/plain','atom' 'application/atom+xml','au' 'audio/basic','avi' 'video/x-msvideo','bcpio' 'application/x-bcpio','bin' 'application/octet-stream','bmp' 'image/bmp','cdf' 'application/x-netcdf','cgm' 'image/cgm','class' 'application/octet-stream','cpio' 'application/x-cpio','cpt' 'application/mac-compactpro','csh' 'application/x-csh','css' 'text/css','dcr' 'application/x-director','dif' 'video/x-dv','dir' 'application/x-director','djv' 'image/vnd.djvu','djvu' 'image/vnd.djvu','dll' 'application/octet-stream','dmg' 'application/octet-stream','dms' 'application/octet-stream','doc' 'application/msword','dtd' 'application/xml-dtd','dv' 'video/x-dv','dvi' 'application/x-dvi','dxr' 'application/x-director','eps' 'application/postscript','etx' 'text/x-setext','exe' 'application/octet-stream','ez' 'application/andrew-inset','flv' 'video/x-flv','gif' 'image/gif','gram' 'application/srgs','grxml' 'application/srgs+xml','gtar' 'application/x-gtar','gz' 'application/x-gzip','hdf' 'application/x-hdf','hqx' 'application/mac-binhex40','htm' 'text/html','html' 'text/html','ice' 'x-conference/x-cooltalk','ico' 'image/x-icon','ics' 'text/calendar','ief' 'image/ief','ifb' 'text/calendar','iges' 'model/iges','igs' 'model/iges','jnlp' 'application/x-java-jnlp-file','jp2' 'image/jp2','jpe' 'image/jpeg','jpeg' 'image/jpeg','jpg' 'image/jpeg','js' 'application/x-javascript','kar' 'audio/midi','latex' 'application/x-latex','lha' 'application/octet-stream','lzh' 'application/octet-stream','m3u' 'audio/x-mpegurl','m4a' 'audio/mp4a-latm','m4p' 'audio/mp4a-latm','m4u' 'video/vnd.mpegurl','m4v' 'video/x-m4v','mac' 'image/x-macpaint','man' 'application/x-troff-man','mathml' 'application/mathml+xml','me' 'application/x-troff-me','mesh' 'model/mesh','mid' 'audio/midi','midi' 'audio/midi','mif' 'application/vnd.mif','mov' 'video/quicktime','movie' 'video/x-sgi-movie','mp2' 'audio/mpeg','mp3' 'audio/mpeg','mp4' 'video/mp4','mpe' 'video/mpeg','mpeg' 'video/mpeg','mpg' 'video/mpeg','mpga' 'audio/mpeg','ms' 'application/x-troff-ms','msh' 'model/mesh','mxu' 'video/vnd.mpegurl','nc' 'application/x-netcdf','oda' 'application/oda','ogg' 'application/ogg','ogv' 'video/ogv','pbm' 'image/x-portable-bitmap','pct' 'image/pict','pdb' 'chemical/x-pdb','pdf' 'application/pdf','pgm' 'image/x-portable-graymap','pgn' 'application/x-chess-pgn','pic' 'image/pict','pict' 'image/pict','png' 'image/png','pnm' 'image/x-portable-anymap','pnt' 'image/x-macpaint','pntg' 'image/x-macpaint','ppm' 'image/x-portable-pixmap','ppt' 'application/vnd.ms-powerpoint', 'ps' 'application/postscript','qt' 'video/quicktime','qti' 'image/x-quicktime','qtif' 'image/x-quicktime','ra' 'audio/x-pn-realaudio','ram' 'audio/x-pn-realaudio','ras' 'image/x-cmu-raster','rdf' 'application/rdf+xml','rgb' 'image/x-rgb','rm' 'application/vnd.rn-realmedia','roff' 'application/x-troff','rtf' 'text/rtf','rtx' 'text/richtext','sgm' 'text/sgml','sgml' 'text/sgml','sh' 'application/x-sh','shar' 'application/x-shar','silo' 'model/mesh','sit' 'application/x-stuffit','skd' 'application/x-koan','skm' 'application/x-koan','skp' 'application/x-koan','skt' 'application/x-koan','smi' 'application/smil','smil' 'application/smil','snd' 'audio/basic','so' 'application/octet-stream','spl' 'application/x-futuresplash','src' 'application/x-wais-source','sv4cpio' 'application/x-sv4cpio','sv4crc' 'application/x-sv4crc','svg' 'image/svg+xml','swf' 'application/x-shockwave-flash','t' 'application/x-troff','tar' 'application/x-tar','tcl' 'application/x-tcl','tex' 'application/x-tex','texi' 'application/x-texinfo','texinfo' 'application/x-texinfo','tif' 'image/tiff','tiff' 'image/tiff','tr' 'application/x-troff','tsv' 'text/tab-separated-values','txt' 'text/plain','ustar' 'application/x-ustar','vcd' 'application/x-cdlink','vrml' 'model/vrml','vxml' 'application/voicexml+xml','wav' 'audio/x-wav','wbmp' 'image/vnd.wap.wbmp','wbxml' 'application/vnd.wap.wbxml','webm' 'video/webm','wml' 'text/vnd.wap.wml','wmlc' 'application/vnd.wap.wmlc','wmls' 'text/vnd.wap.wmlscript','wmlsc' 'application/vnd.wap.wmlscriptc', 'wmv' 'video/x-ms-wmv','wrl' 'model/vrml','xbm' 'image/x-xbitmap','xht' 'application/xhtml+xml','xhtml' 'application/xhtml+xml','xls' 'application/vnd.ms-excel','xml' 'application/xml','xpm' 'image/x-xpixmap','xsl' 'application/xml','xslt' 'application/xslt+xml','xul' 'application/vnd.mozilla.xul+xml','xwd' 'image/x-xwindowdump','xyz' 'chemical/x-xyz','zip' 'application/zip'。
下载及web文件的contentType类型大全
下载及web⽂件的contentType类型⼤全⽂件下载及web⽂件的contentType类型⼤全String filePath="";File file=new File(filePath);//解决乱码问题String filename=URLEncoder.encode(file.getName(),"utf-8");//重置输出流response.reset();Response.AddHeader("Content-Disposition", "attachment;filename="+filename);//设置⽂件名response.addHeader("Content-Length",file.length);//设置下载⽂件⼤⼩response.setContentType("application/octet-stream");//设置⽂件类型OutputStream toClient=new BufferedOuntputStream( response.getOutputStream() );//获取⼆进制输出流//读取⽂件数据InputStream fis=new BufferedInputStream(new FileInputStream(filePath));byte[] buffer=new byte[file.length()];fis.read(buffer);fis.close();//输出⽂件数据toClient.write(buffer);toClient.close();⽂件类型如下:".*"="application/octet-stream"".001"="application/x-001"".301"="application/x-301"".323"="text/h323"".906"="application/x-906"".907"="drawing/907"".a11"="application/x-a11"".acp"="audio/x-mei-aac"".ai"="application/postscript"".aif"="audio/aiff"".aifc"="audio/aiff"".aiff"="audio/aiff"".anv"="application/x-anv"".asa"="text/asa"".asf"="video/x-ms-asf"".asp"="text/asp"".asx"="video/x-ms-asf"".au"="audio/basic"".avi"="video/avi"".awf"="application/vnd.adobe.workflow"".biz"="text/xml"".bmp"="application/x-bmp"".bot"="application/x-bot"".c4t"="application/x-c4t"".c90"="application/x-c90"".cal"="application/x-cals"".cat"="application/vnd.ms-pki.seccat"".cdf"="application/x-netcdf"".cdr"="application/x-cdr"".cel"="application/x-cel"".cer"="application/x-x509-ca-cert"".cg4"="application/x-g4"".cgm"="application/x-cgm"".cit"="application/x-cit"".class"="java/*"".cml"="text/xml"".cmp"="application/x-cmp"".cmx"="application/x-cmx"".cot"="application/x-cot"".crl"="application/pkix-crl"".crt"="application/x-x509-ca-cert"".csi"="application/x-csi"".css"="text/css"".cut"="application/x-cut"".dbf"="application/x-dbf"".dbm"="application/x-dbm"".dbx"="application/x-dbx"".dcd"="text/xml"".dcx"="application/x-dcx"".der"="application/x-x509-ca-cert" ".dgn"="application/x-dgn"".dib"="application/x-dib"".dll"="application/x-msdownload" ".doc"="application/msword"".dot"="application/msword"".drw"="application/x-drw"".dtd"="text/xml"".dwf"="Model/vnd.dwf"".dwf"="application/x-dwf"".dwg"="application/x-dwg"".dxb"="application/x-dxb"".dxf"="application/x-dxf"".edn"="application/vnd.adobe.edn" ".emf"="application/x-emf"".eml"="message/rfc822"".ent"="text/xml"".epi"="application/x-epi"".eps"="application/x-ps"".eps"="application/postscript"".etd"="application/x-ebx"".exe"="application/x-msdownload" ".fax"="image/fax"".fdf"="application/vnd.fdf"".fif"="application/fractals"".fo"="text/xml"".frm"="application/x-frm"".g4"="application/x-g4"".gbr"="application/x-gbr"".gcd"="application/x-gcd"".gif"="image/gif"".gl2"="application/x-gl2"".gp4"="application/x-gp4"".hgl"="application/x-hgl"".hmr"="application/x-hmr"".hpg"="application/x-hpgl"".hpl"="application/x-hpl"".hqx"="application/mac-binhex40" ".hrf"="application/x-hrf"".hta"="application/hta"".htc"="text/x-component"".htm"="text/html"".html"="text/html"".htt"="text/webviewhtml"".htx"="text/html"".icb"="application/x-icb"".ico"="image/x-icon"".ico"="application/x-ico"".iff"="application/x-iff"".ig4"="application/x-g4"".igs"="application/x-igs"".iii"="application/x-iphone"".img"="application/x-img"".ins"="application/x-internet-signup" ".isp"="application/x-internet-signup" ".IVF"="video/x-ivf"".java"="java/*"".jfif"="image/jpeg"".jpe"="image/jpeg"".jpe"="application/x-jpe"".jpeg"="image/jpeg"".jpg"="image/jpeg"".jpg"="application/x-jpg"".js"="application/x-javascript"".jsp"="text/html"".la1"="audio/x-liquid-file"".lar"="application/x-laplayer-reg" ".latex"="application/x-latex"".lavs"="audio/x-liquid-secure"".lbm"="application/x-lbm"".lmsff"="audio/x-la-lms"".ls"="application/x-javascript"".ltr"="application/x-ltr"".m1v"="video/x-mpeg"".m2v"="video/x-mpeg"".m3u"="audio/mpegurl"".m4e"="video/mpeg4"".mac"="application/x-mac"".man"="application/x-troff-man"".math"="text/xml"".mdb"="application/msaccess"".mdb"="application/x-mdb"".mfp"="application/x-shockwave-flash" ".mht"="message/rfc822"".mhtml"="message/rfc822"".mi"="application/x-mi"".mid"="audio/mid"".midi"="audio/mid"".mil"="application/x-mil"".mml"="text/xml"".mnd"="audio/x-musicnet-download" ".mns"="audio/x-musicnet-stream" ".mocha"="application/x-javascript" ".movie"="video/x-sgi-movie"".mp1"="audio/mp1"".mp2"="audio/mp2"".mp2v"="video/mpeg"".mp3"="audio/mp3"".mp4"="video/mpeg4"".mpa"="video/x-mpg"".mpd"="application/vnd.ms-project" ".mpe"="video/x-mpeg"".mpeg"="video/mpg"".mpg"="video/mpg"".mpga"="audio/rn-mpeg"".mpp"="application/vnd.ms-project" ".mps"="video/x-mpeg"".mpt"="application/vnd.ms-project" ".mpv"="video/mpg"".mpv2"="video/mpeg"".mpw"="application/vnd.ms-project" ".mpx"="application/vnd.ms-project" ".mtx"="text/xml"".mxp"="application/x-mmxp"".net"="image/pnetvue"".nrf"="application/x-nrf"".nws"="message/rfc822"".odc"="text/x-ms-odc"".out"="application/x-out"".p10"="application/pkcs10"".p12"="application/x-pkcs12"".p7b"="application/x-pkcs7-certificates" ".p7c"="application/pkcs7-mime"".p7m"="application/pkcs7-mime"".p7r"="application/x-pkcs7-certreqresp" ".p7s"="application/pkcs7-signature" ".pc5"="application/x-pc5"".pci"="application/x-pci"".pcl"="application/x-pcl"".pcx"="application/x-pcx"".pdf"="application/pdf"".pdf"="application/pdf"".pdx"="application/vnd.adobe.pdx" ".pfx"="application/x-pkcs12"".pgl"="application/x-pgl"".pic"="application/x-pic"".pko"="application/vnd.ms-pki.pko" ".pl"="application/x-perl"".plg"="text/html"".pls"="audio/scpls"".plt"="application/x-plt"".png"="image/png"".png"="application/x-png"".pot"="application/vnd.ms-powerpoint" ".ppa"="application/vnd.ms-powerpoint" ".ppm"="application/x-ppm"".pps"="application/vnd.ms-powerpoint" ".ppt"="application/vnd.ms-powerpoint" ".ppt"="application/x-ppt"".pr"="application/x-pr"".prf"="application/pics-rules"".prn"="application/x-prn"".prt"="application/x-prt"".ps"="application/x-ps"".ps"="application/postscript"".ptn"="application/x-ptn"".pwz"="application/vnd.ms-powerpoint" ".r3t"="text/vnd.rn-realtext3d"".ra"="audio/vnd.rn-realaudio"".ram"="audio/x-pn-realaudio"".rdf"="text/xml"".rec"="application/vnd.rn-recording"".red"="application/x-red"".rgb"="application/x-rgb"".rjs"="application/vnd.rn-realsystem-rjs"".rjt"="application/vnd.rn-realsystem-rjt"".rlc"="application/x-rlc"".rle"="application/x-rle"".rm"="application/vnd.rn-realmedia"".rmf"="application/vnd.adobe.rmf"".rmi"="audio/mid"".rmj"="application/vnd.rn-realsystem-rmj" ".rmm"="audio/x-pn-realaudio"".rmp"="application/vnd.rn-rn_music_package" ".rms"="application/vnd.rn-realmedia-secure" ".rmvb"="application/vnd.rn-realmedia-vbr" ".rmx"="application/vnd.rn-realsystem-rmx" ".rnx"="application/vnd.rn-realplayer"".rp"="image/vnd.rn-realpix"".rpm"="audio/x-pn-realaudio-plugin"".rsml"="application/vnd.rn-rsml"".rt"="text/vnd.rn-realtext"".rtf"="application/msword"".rtf"="application/x-rtf"".rv"="video/vnd.rn-realvideo"".sam"="application/x-sam"".sat"="application/x-sat"".sdp"="application/sdp"".sdw"="application/x-sdw"".sit"="application/x-stuffit"".slb"="application/x-slb"".sld"="application/x-sld"".slk"="drawing/x-slk"".smi"="application/smil"".smil"="application/smil"".smk"="application/x-smk"".snd"="audio/basic"".sol"="text/plain"".sor"="text/plain"".spc"="application/x-pkcs7-certificates"".spl"="application/futuresplash"".spp"="text/xml"".ssm"="application/streamingmedia"".sst"="application/vnd.ms-pki.certstore" ".stl"="application/vnd.ms-pki.stl"".stm"="text/html"".sty"="application/x-sty"".svg"="text/xml"".swf"="application/x-shockwave-flash"".tdf"="application/x-tdf"".tg4"="application/x-tg4"".tga"="application/x-tga"".tif"="image/tiff"".tif"="application/x-tif"".tiff"="image/tiff"".tld"="text/xml"".top"="drawing/x-top"".torrent"="application/x-bittorrent"".tsd"="text/xml"".txt"="text/plain"".uin"="application/x-icq"".uls"="text/iuls"".vcf"="text/x-vcard"".vda"="application/x-vda"".vdx"="application/vnd.visio"".vml"="text/xml"".vpg"="application/x-vpeg005"".vsd"="application/vnd.visio"".vsd"="application/x-vsd"".vss"="application/vnd.visio"".vst"="application/vnd.visio"".vst"="application/x-vst"".vsw"="application/vnd.visio"".vsx"="application/vnd.visio"".vtx"="application/vnd.visio"".vxml"="text/xml"".wav"="audio/wav"".wax"="audio/x-ms-wax"".wb1"="application/x-wb1"".wb2"="application/x-wb2"".wb3"="application/x-wb3"".wbmp"="image/vnd.wap.wbmp"".wk4"="application/x-wk4"".wkq"="application/x-wkq"".wks"="application/x-wks"".wm"="video/x-ms-wm"".wma"="audio/x-ms-wma"".wmd"="application/x-ms-wmd" ".wmf"="application/x-wmf"".wml"="text/vnd.wap.wml"".wmv"="video/x-ms-wmv"".wmx"="video/x-ms-wmx"".wmz"="application/x-ms-wmz" ".wp6"="application/x-wp6"".wpd"="application/x-wpd"".wpg"="application/x-wpg"".wpl"="application/vnd.ms-wpl" ".wq1"="application/x-wq1"".wr1"="application/x-wr1"".wri"="application/x-wri"".wrk"="application/x-wrk"".ws"="application/x-ws"".ws2"="application/x-ws"".wsc"="text/scriptlet"".wsdl"="text/xml"".wvx"="video/x-ms-wvx"".xdp"="application/vnd.adobe.xdp" ".xdr"="text/xml"".xfd"="application/vnd.adobe.xfd" ".xfdf"="application/vnd.adobe.xfdf" ".xhtml"="text/html"".xls"="application/vnd.ms-excel" ".xls"="application/x-xls"".xlw"="application/x-xlw"".xml"="text/xml"".xpl"="audio/scpls"".xq"="text/xml"".xql"="text/xml"".xquery"="text/xml"".xsd"="text/xml"".xsl"="text/xml"".xslt"="text/xml"".xwd"="application/x-xwd"".x_b"="application/x-x_b"".x_t"="application/x-x_t"。
content-type文件后缀大全
文件扩展名Content-Type(Mime-Type) 文件扩展名Content-Type(Mime-Type).*(二进制流,不知道下载文件类型)application/octet-stream .tif image/tiff.001 application/x-001 .301 application/x-301.323 text/h323 .906 application/x-906.907 drawing/907 .a11 application/x-a11.acp audio/x-mei-aac .ai application/postscript .aif audio/aiff .aifc audio/aiff.aiff audio/aiff .anv application/x-anv.asa text/asa .asf video/x-ms-asf.asp text/asp .asx video/x-ms-asf.au audio/basic .avi video/avi.awf application/vnd.adobe.workflow .biz text/xml.c4t application/x-c4t .c90 application/x-c90.cal application/x-cals .cat application/vnd.ms-pki.seccat .cdf application/x-netcdf .cdr application/x-cdr.cel application/x-cel .cer application/x-x509-ca-cert.cg4 application/x-g4 .cgm application/x-cgm.cit application/x-cit .class java/*.cml text/xml .cmp application/x-cmp.cmx application/x-cmx .cot application/x-cot.crl application/pkix-crl .crt application/x-x509-ca-cert.csi application/x-csi .css text/css.cut application/x-cut .dbf application/x-dbf.dcd text/xml .dcx application/x-dcx.der application/x-x509-ca-cert .dgn application/x-dgn.dib application/x-dib .dll application/x-msdownload .doc application/msword .dot application/msword.drw application/x-drw .dtd text/xml.dwf Model/vnd.dwf .dwf application/x-dwf.dwg application/x-dwg .dxb application/x-dxb.dxf application/x-dxf .edn application/vnd.adobe.edn .emf application/x-emf .eml message/rfc822.ent text/xml .epi application/x-epi.eps application/x-ps .eps application/postscript.etd application/x-ebx .exe application/x-msdownload .fax image/fax .fdf application/vnd.fdf.fif application/fractals .fo text/xml.frm application/x-frm .g4 application/x-g4.gbr application/x-gbr . application/x-.gif image/gif .gl2 application/x-gl2.gp4 application/x-gp4 .hgl application/x-hgl.hmr application/x-hmr .hpg application/x-hpgl.hpl application/x-hpl .hqx application/mac-binhex40 .hrf application/x-hrf .hta application/hta.htc text/x-component .htm text/html.html text/html .htt text/webviewhtml.htx text/html .icb application/x-icb.ico image/x-icon .ico application/x-ico.iff application/x-iff .ig4 application/x-g4.igs application/x-igs .iii application/x-iphone.img application/x-img .ins application/x-internet-signup .isp application/x-internet-signup .IVF video/x-ivf.java java/* .jfif image/jpeg.jpe image/jpeg .jpe application/x-jpe.jpeg image/jpeg .jpg image/jpeg.jpg application/x-jpg .js application/x-javascript.jsp text/html .la1 audio/x-liquid-file.lar application/x-laplayer-reg .latex application/x-latex.lavs audio/x-liquid-secure .lbm application/x-lbm.lmsff audio/x-la-lms .ls application/x-javascript .ltr application/x-ltr .m1v video/x-mpeg.m2v video/x-mpeg .m3u audio/mpegurl.m4e video/mpeg4 .mac application/x-mac.man application/x-troff-man .math text/xml.mdb application/msaccess .mdb application/x-mdb.mfp application/x-shockwave-flash .mht message/rfc822.mhtml message/rfc822 .mi application/x-mi.mid audio/mid .midi audio/mid.mil application/x-mil .mml text/xml.mnd audio/x-musicnet-download .mns audio/x-musicnet-stream.mocha application/x-javascript .movie video/x-sgi-movie.mp1 audio/mp1 .mp2 audio/mp2.mp2v video/mpeg .mp3 audio/mp3.mp4 video/mpeg4 .mpa video/x-mpg.mpd application/vnd.ms-project .mpe video/x-mpeg.mpeg video/mpg .mpg video/mpg.mpga audio/rn-mpeg .mpp application/vnd.ms-project .mps video/x-mpeg .mpt application/vnd.ms-project .mpv video/mpg .mpv2 video/mpeg.mpw application/vnd.ms-project .mpx application/vnd.ms-project .mtx text/xml .mxp application/x-mmxp.net image/pnetvue .nrf application/x-nrf.nws message/rfc822 .odc text/x-ms-odc.out application/x-out .p10 application/pkcs10.p12 application/x-pkcs12 .p7b application/x-pkcs7-certificates .p7c application/pkcs7-mime .p7m application/pkcs7-mime.p7r application/x-pkcs7-certreqresp .p7s application/pkcs7-signature.pc5 application/x-pc5 .pci application/x-pci.pcl application/x-pcl .pcx application/x-pcx.pdf application/pdf .pdf application/pdf.pdx application/vnd.adobe.pdx .pfx application/x-pkcs12.pgl application/x-pgl .pic application/x-pic.pko application/vnd.ms-pki.pko .pl application/x-perl.plg text/html .pls audio/scpls.plt application/x-plt .png image/png.png application/x-png .pot application/vnd.ms-powerpoint .ppa application/vnd.ms-powerpoint .ppm application/x-ppm.pps application/vnd.ms-powerpoint .ppt application/vnd.ms-powerpoint .ppt application/x-ppt .pr application/x-pr.prf application/pics-rules .prn application/x-prn.prt application/x-prt .ps application/x-ps.ps application/postscript .ptn application/x-ptn.pwz application/vnd.ms-powerpoint .r3t text/vnd.rn-realtext3d.ra audio/vnd.rn-realaudio .ram audio/x-pn-realaudio.ras application/x-ras .rat application/rat-file.rdf text/xml .rec application/vnd.rn-recording.red application/x-red .rgb application/x-rgb.rjs application/vnd.rn-realsystem-rjs .rjt application/vnd.rn-realsystem-rjt.rlc application/x-rlc .rle application/x-rle.rm application/vnd.rn-realmedia .rmf application/vnd.adobe.rmf.rmi audio/mid .rmj application/vnd.rn-realsystem-rmj.rmm audio/x-pn-realaudio .rmp application/vnd.rn-rn_music_package .rms application/vnd.rn-realmedia-secure .rmvb application/vnd.rn-realmedia-vbr.rmx application/vnd.rn-realsystem-rmx .rnx application/vnd.rn-realplayer.rp image/vnd.rn-realpix .rpm audio/x-pn-realaudio-plugin.rsml application/vnd.rn-rsml .rt text/vnd.rn-realtext.rtf application/msword .rtf application/x-rtf.rv video/vnd.rn-realvideo .sam application/x-sam.sat application/x-sat .sdp application/sdp.sdw application/x-sdw .sit application/x-stuffit.slb application/x-slb .sld application/x-sld.slk drawing/x-slk .smi application/smil.smil application/smil .smk application/x-smk.snd audio/basic .sol text/plain.sor text/plain .spc application/x-pkcs7-certificates .spl application/futuresplash .spp text/xml.ssm application/streamingmedia .sst application/vnd.ms-pki.certstore .stl application/vnd.ms-pki.stl .stm text/html.sty application/x-sty .svg text/xml.swf application/x-shockwave-flash .tdf application/x-tdf.tg4 application/x-tg4 .tga application/x-tga.tif image/tiff .tif application/x-tif.tiff image/tiff .tld text/xml.top drawing/x-top .torrent application/x-bittorrent .tsd text/xml .txt text/plain.uin application/x-icq .uls text/iuls.vcf text/x-vcard .vda application/x-vda.vdx application/vnd.visio .vml text/xml.vpg application/x-vpeg005 .vsd application/vnd.visio .vsd application/x-vsd .vss application/vnd.visio .vst application/vnd.visio .vst application/x-vst.vsw application/vnd.visio .vsx application/vnd.visio.vtx application/vnd.visio .vxml text/xml.wav audio/wav .wax audio/x-ms-wax.wb1 application/x-wb1 .wb2 application/x-wb2.wb3 application/x-wb3 .wbmp image/vnd.wap.wbmp .wiz application/msword .wk3 application/x-wk3.wk4 application/x-wk4 .wkq application/x-wkq.wks application/x-wks .wm video/x-ms-wm.wma audio/x-ms-wma .wmd application/x-ms-wmd .wmf application/x-wmf .wml text/vnd.wap.wml.wmv video/x-ms-wmv .wmx video/x-ms-wmx.wmz application/x-ms-wmz .wp6 application/x-wp6.wpd application/x-wpd .wpg application/x-wpg.wpl application/vnd.ms-wpl .wq1 application/x-wq1.wr1 application/x-wr1 .wri application/x-wri.wrk application/x-wrk .ws application/x-ws.ws2 application/x-ws .wsc text/scriptlet.wsdl text/xml .wvx video/x-ms-wvx.xdp application/vnd.adobe.xdp .xdr text/xml.xfd application/vnd.adobe.xfd .xfdf application/vnd.adobe.xfdf .xhtml text/html .xls application/vnd.ms-excel .xls application/x-xls .xlw application/x-xlw.xml text/xml .xpl audio/scpls.xq text/xml .xql text/xml.xquery text/xml .xsd text/xml.xsl text/xml .xslt text/xml.xwd application/x-xwd .x_b application/x-x_b.sis application/vnd.symbian.install .sisx application/vnd.symbian.install .x_t application/x-x_t .ipa application/vnd.iphone.apk application/vnd.android.package-archive .xap application/x-silverlight-app。
ASP.NET根据后缀获取ContentType类型
根据后缀获取ContentType类型花了⼏天时间去研究了⼀下邮件管理系统,在C#下基于⼀个免费的JMAIL 4.4这个DLL。
为什么不选 1.1的? 1.1发邮件很不错,但是他没有POP3,所以收不了邮件。
说说我遇到⼀个问题,在发附件的时候,关于ContetnType类型之间的选择问题。
来做⼀个测试例⼦,代码如下:1、在C盘建⼀个ContentType.txt⽂件ez,application/andrew-insethqx,application/mac-binhex40cpt,application/mac-compactprodoc,application/mswordbin,application/octet-streamdms,application/octet-streamlha,application/octet-streamlzh,application/octet-streamexe,application/octet-streamclass,application/octet-streamso,application/octet-streamdll,application/octet-streamoda,application/odapdf,application/pdfai,application/postscripteps,application/postscriptps,application/postscriptsmi,application/smilsmil,application/smilmif,application/vnd.mifxls,application/vnd.ms-excelppt,application/vnd.ms-powerpointwbxml,application/vnd.wap.wbxmlwmlc,application/vnd.wap.wmlcwmlsc,application/vnd.wap.wmlscriptcbcpio,application/x-bcpiovcd,application/x-cdlinkpgn,application/x-chess-pgncpio,application/x-cpiocsh,application/x-cshdcr,application/x-directordir,application/x-directordxr,application/x-directordvi,application/x-dvispl,application/x-futuresplashgtar,application/x-gtarhdf,application/x-hdfjs,application/x-javascriptskp,application/x-koanskd,application/x-koanskt,application/x-koanskm,application/x-koanlatex,application/x-latexnc,application/x-netcdfcdf,application/x-netcdfsh,application/x-shshar,application/x-sharswf,application/x-shockwave-flashsit,application/x-stuffitsv4cpio,application/x-sv4cpiosv4crc,application/x-sv4crctar,application/x-tartcl,application/x-tcltex,application/x-textexinfo,application/x-texinfotexi,application/x-texinfotr,application/x-troffroff,application/x-troffman,application/x-troff-manme,application/x-troff-mems,application/x-troff-msustar,application/x-ustarsrc,application/x-wais-sourcexhtml,application/xhtml+xmlxht,application/xhtml+xmlzip,application/zipau,audio/basicsnd,audio/basicmid,audio/midimidi,audio/midikar,audio/midimpga,audio/mpegmp2,audio/mpegmp3,audio/mpegaif,audio/x-aiffaiff,audio/x-aiffaifc,audio/x-aiffm3u,audio/x-mpegurlram,audio/x-pn-realaudiorm,audio/x-pn-realaudiorpm,audio/x-pn-realaudio-pluginra,audio/x-realaudiowav,audio/x-wavpdb,chemical/x-pdbxyz,chemical/x-xyzbmp,image/bmpgif,image/gifief,image/iefjpeg,image/jpegjpg,image/jpegjpe,image/jpegpng,image/pngtiff,image/tifftif,image/tiffdjvu,image/vnd.djvudjv,image/vnd.djvuwbmp,image/vnd.wap.wbmpras,image/x-cmu-rasterpnm,image/x-portable-anymappbm,image/x-portable-bitmappgm,image/x-portable-graymapppm,image/x-portable-pixmaprgb,image/x-rgbxbm,image/x-xbitmapxpm,image/x-xpixmapxwd,image/x-xwindowdumpigs,model/igesiges,model/igesmsh,model/meshmesh,model/meshsilo,model/meshwrl,model/vrmlvrml,model/vrmlcss,text/csshtml,text/htmlhtm,text/htmlasc,text/plaintxt,text/plainrtx,text/richtextrtf,text/rtfsgml,text/sgmlsgm,text/sgmltsv,text/tab-separated-valueswml,text/vnd.wap.wmlwmls,text/vnd.wap.wmlscriptetx,text/x-setextxsl,text/xmlxml,text/xmlmpeg,video/mpegmpg,video/mpegmpe,video/mpegqt,video/quicktimemov,video/quicktimemxu,video/vnd.mpegurlavi,video/x-msvideomovie,video/x-sgi-movieice,x-conference/x-cooltalk2、在C#⾥做的测试,loadDicContentType和getContentTypeclass Program{static void Main(string[] args){loadDicContentType();Console.WriteLine(getContentTypeValue("class"));Console.ReadLine();}static Dictionary<string, string> dicContentType = new Dictionary<string, string>(); static void loadDicContentType(){string[] contentTypes = File.ReadAllLines(@"c:\contentType.txt"); foreach (string contentType in contentTypes){string[] types = contentType.Split(',');string key = types[0];string value = types[1];dicContentType.Add(key, value);}}static string getContentTypeValue(string key){string value = dicContentType[key];return value;}}。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
'wav' => 'audio/x-wav',
'pdb' => 'chemical/x-pdb',
'xyz' => 'chemical/x-xyz',
'bcpio' => 'application/x-bcpio',
'vcd' => 'application/x-cdlink',
'pgn' => 'application/x-chess-pgn',
'cpio' => 'application/x-cpio',
'ms' => 'application/x-troff-ms',
'ustar' => 'application/x-ustar',
'src' => 'application/x-wais-source',
'xhtml' => 'application/xhtml+xml',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
'so' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => 'application/pdf',
'tex' => 'application/x-tex',
'texinfo' => 'application/x-texinfo',
'texi' => 'application/x-texinfo',
't' => 'application/x-troff',
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'm3u' => 'audio/x-mpegurl',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'iges' => 'model/iges',
'msh' => 'model/mesh',
'mesh' => 'model/mesh',
'silo' => 'model/mesh',
'wrl' => 'model/vrml',
'ez' => 'application/andrew-inset',
'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'doc' => 'application/msword',
'wbxml' => 'application/vnd.wap.wbxml',
'wmlc' => 'application/vnd.wap.wmlc',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'skm' => 'application/x-koan',
'latex' => 'application/x-latex',
'nc' => 'application/x-netcdf',
'cdf' => 'application/x-netcdf',
'csh' => 'application/x-csh',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'bmp' => 'image/bmp',
'gif' => 'image/gif',
'ief' => 'image/ief',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'vrml' => 'model/vrml',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',
'xht' => 'application/xhtml+xml',
'zip' => 'application/zip',
'rar' => ''application/octet-stream'
'au' => 'audio/basic',
'sv4cpio' => 'application/x-sv4cpio',
'sv4crc' => 'application/x-sv4crc',
'tar' => 'application/x-tar',
'tcl' => 'application/x-tcl',
'snd' => 'audio/basic',
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'kar' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => 'audio/mpeg',
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'dvi' => 'application/x-dvi',
'spl' => 'application/x-futuresplash',
'gtar' => 'application/x-gtar',