HTTP content-type
Content-Type
(content type), which generally refers to the Content-Type
used to define the type of web file and the encoding of the web page,and to determine what form and encoding the browser will read the file, which is why you often see some PHP pages click only to download a file or apicture.
The Content-Type header tells the client the type of content that is actually returned.
Syntax format:
Content-Type: text/html; charset=utf-8
Content-Type: multipart/form-data; boundary=something
Example:
Common media formats are as follows:
Text/html: HTML format
Text/plain: plain text format
Text/xml: XML format
Image/gif: gif picture format
Image/jpeg: jpg picture format
Image/png:png picture format
Type of media format that begins with application:
Application/xhtml+xml: XHTML format
Application/xml: XML data format
Application/atom+xml: Atom XML aggregation format
Application/json: JSON data format
Application/pdf:pdf format
Application/msword: Word document format
Application/octet-stream: binary stream data (such as common file downloads)
The default encType,form form data in application/x-www-form-urlencoded: < form encType= “> is encoded and sent to the server in key/value format (theform’s default format for submitting data)
Another common media format is used when uploading files:
Multipart/form-data: this format is required when you need to upload files in the form
HTTP content-type comparison table
File extension |
Content-Type (Mime-Type) |
File extension |
Content-Type (Mime-Type) |
---|---|---|---|
|
Application/octet-stream |
.tif |
Image/tiff |
|
Application/x-001 |
0.301 |
Application/x-301 |
|
Text/h323 |
0.906 |
Application/x-906 |
|
Drawing/907 |
.a11 |
Application/x-a11 |
|
audio/x-mei-aac |
.ai |
Application/postscript |
|
Audio/aiff |
.aifc |
Audio/aiff |
|
Audio/aiff |
.anv |
Application/x-anv |
|
Text/asa |
.asf |
Video/x-ms-asf |
|
Text/asp |
.asx |
Video/x-ms-asf |
|
Audio/basic |
.avi |
Video/avi |
|
application/vnd.adobe.workflow |
.biz |
Text/xml |
|
application/x-bmp |
.bot |
Application/x-bot |
|
Application/x-c4t |
.c90 |
Application/x-c90 |
|
Application/x-cals |
.cat |
Application/vnd.ms-pki.seccat |
|
Application/x-netcdf |
.cdr |
application/x-cdr |
|
Application/x-cel |
.cer |
Application/x-x509-ca-cert |
|
Application/x-g4 |
.cgm |
pplication/x-cgm |
|
Application/x-cit |
.class |
Java/* |
|
Text/xml |
.cmp |
Application/x-cmp |
|
application/x-cmx |
.cot |
Application/x-cot |
|
Application/pkix-crl |
.crt |
Application/x-x509-ca-cert |
|
Application/x-csi |
.css |
Text/css |
|
Application/x-cut |
.dbf |
Application/x-dbf |
|
Application/x-dbm |
.dbx |
Application/x-dbx |
|
Text/xml |
.dcx |
Application/x-dcx |
|
Application/x-x509-ca-cert |
.dgn |
Application/x-dgn |
|
application/x-dib |
.dll |
Application/x-msdownload |
|
Application/msword |
.dot |
Application/msword |
|
Application/x-drw |
.dtd |
Text/xml |
|
Model/vnd.dwf |
.dwf |
Application/x-dwf |
|
Application/x-dwg |
.dxb |
Application/x-dxb |
|
application/x-dxf |
.edn |
application/vnd.adobe.edn |
|
Application/x-emf |
.eml |
Message/rfc822 |
|
Text/xml |
.epi |
application/x-epi |
|
Application/x-ps |
.eps |
Application/postscript |
|
Application/x-ebx |
.exe |
Application/x-msdownload |
|
Image/fax |
.fdf |
application/vnd.fdf |
|
application/fractals |
.fo |
Text/xml |
|
Application/x-frm |
.g4 |
Application/x-g4 |
|
Application/x-gbr |
. |
Application/x- |
|
Image/gif |
.gl2 |
Application/x-gl2 |
|
Application/x-gp4 |
.hgl |
Application/x-hgl |
|
Application/x-hmr |
.hpg |
Application/x-hpgl |
|
Application/x-hpl |
.hqx |
Application/mac-binhex40 |
|
Application/x-hrf |
.hta |
Application/hta |
|
Text/x-component |
.htm |
Text/html |
|
Text/html |
.htt |
Text/webviewhtml |
|
Text/html |
.icb |
Application/x-icb |
|
Image/x-icon |
.ico |
Application/x-ico |
|
Application/x-iff |
.ig4 |
Application/x-g4 |
|
Application/x-igs |
.iii |
Application/x-iphone |
|
Application/x-img |
.ins |
Application/x-internet-signup |
|
Application/x-internet-signup |
.IVF |
Video/x-ivf |
|
Java/* |
.jfif |
Image/jpeg |
|
Image/jpeg |
.jpe |
application/x-jpe |
|
Image/jpeg |
.jpg |
Image/jpeg |
|
Application/x-jpg |
.js |
Application/x-javascript |
|
Text/html |
.la1 |
audio/x-liquid-file |
|
Application/x-laplayer-reg |
.latex |
Application/x-latex |
|
Audio/x-liquid-secure |
.lbm |
application/x-lbm |
|
Audio/x-la-lms |
.ls |
Application/x-javascript |
|
Application/x-ltr |
.m1v |
Video/x-mpeg |
|
Video/x-mpeg |
.m3u |
Audio/mpegurl |
|
Video/mpeg4 |
.mac |
Application/x-mac |
|
Application/x-troff-man |
.math |
Text/xml |
|
Application/msaccess |
.mdb |
Application/x-mdb |
|
application/x-shockwave-flash |
.mht |
Message/rfc822 |
|
Message/rfc822 |
.mi |
Application/x-mi |
|
Audio/mid |
.midi |
Audio/mid |
|
application/x-mil |
.mml |
Text/xml |
|
Audio/x-musicnet-download |
.mns |
Audio/x-musicnet-stream |
|
Application/x-javascript |
.movie |
video/x-sgi-movie |
|
Audio/mp1 |
.mp2 |
Audio/mp2 |
|
Video/mpeg |
.mp3 |
audio/mp3 |
|
Video/mpeg4 |
. mpa |
Video/x-mpg |
|
Application/vnd.ms-project |
.mpe |
Video/x-mpeg |
|
Video/mpg |
.mpg |
Video/mpg |
|
Audio/rn-mpeg |
.mpp |
Application/vnd.ms-project |
|
Video/x-mpeg |
.mpt |
Application/vnd.ms-project |
|
Video/mpg |
.mpv2 |
Video/mpeg |
|
Application/vnd.ms-project |
.mpx |
Application/vnd.ms-project |
|
Text/xml |
.mxp |
Application/x-mmxp |
|
Image/pnetvue |
.nrf |
Application/x-nrf |
|
Message/rfc822 |
.odc |
Text/x-ms-odc |
|
Application/x-out |
.p10 |
Application/pkcs10 |
|
application/x-pkcs12 |
.p7b |
Application/x-pkcs7-certificates |
|
Application/pkcs7-mime |
.p7m |
Application/pkcs7-mime |
|
Application/x-pkcs7-certreqresp |
.p7s |
Application/pkcs7-signature |
|
Application/x-pc5 |
.pci |
Application/x-pci |
|
Application/x-pcl |
.pcx |
Application/x-pcx |
|
Application/pdf |
Application/pdf |
|
|
application/vnd.adobe.pdx |
.pfx |
application/x-pkcs12 |
|
application/x-pgl |
.pic |
Application/x-pic |
|
Application/vnd.ms-pki.pko |
.pl |
Application/x-perl |
|
Text/html |
.pls |
Audio/scpls |
|
Application/x-plt |
.png |
Image/png |
|
Application/x-png |
.pot |
application/vnd.ms-powerpoint |
|
application/vnd.ms-powerpoint |
.ppm |
Application/x-ppm |
|
application/vnd.ms-powerpoint |
.ppt |
application/vnd.ms-powerpoint |
|
Application/x-ppt |
.pr |
application/x-pr |
|
Application/pics-rules |
.prn |
Application/x-prn |
|
Application/x-prt |
.ps |
Application/x-ps |
|
Application/postscript |
.ptn |
Application/x-ptn |
|
application/vnd.ms-powerpoint |
.r3t |
Text/vnd.rn-realtext3d |
|
Audio/vnd.rn-realaudio |
.ram |
audio/x-pn-realaudio |
|
Application/x-ras |
.rat |
Application/rat-file |
|
Text/xml |
.rec |
Application/vnd.rn-recording |
|
Application/x-red |
.rgb |
Application/x-rgb |
|
Application/vnd.rn-realsystem-rjs |
.rjt |
application/vnd.rn-realsystem-rjt |
|
Application/x-rlc |
.rle |
Application/x-rle |
|
Application/vnd.rn-realmedia |
.rmf |
application/vnd.adobe.rmf |
|
Audio/mid |
.rmj |
Application/vnd.rn-realsystem-rmj |
|
audio/x-pn-realaudio |
.rmp |
Application/vnd.rn-rn_music_package |
|
Application/vnd.rn-realmedia-secure |
.rmvb |
application/vnd.rn-realmedia-vbr |
|
Application/vnd.rn-realsystem-rmx |
.rnx |
Application/vnd.rn-realplayer |
|
Image/vnd.rn-realpix |
.rpm |
Audio/x-pn-realaudio-plugin |
|
Application/vnd.rn-rsml |
.rt |
Text/vnd.rn-realtext |
|
Application/msword |
.rtf |
application/x-rtf |
|
Video/vnd.rn-realvideo |
.sam |
Application/x-sam |
|
Application/x-sat |
.sdp |
Application/sdp |
|
Application/x-sdw |
.sit |
Application/x-stuffit |
|
Application/x-slb |
.sld |
Application/x-sld |
|
Drawing/x-slk |
.smi |
Application/smil |
|
Application/smil |
.smk |
application/x-smk |
|
Audio/basic |
.sol |
Text/plain |
|
Text/plain |
.spc |
Application/x-pkcs7-certificates |
|
Application/futuresplash |
.spp |
Text/xml |
|
Application/streamingmedia |
.sst |
Application/vnd.ms-pki.certstore |
|
Application/vnd.ms-pki.stl |
.stm |
Text/html |
|
application/x-sty |
.svg |
Text/xml |
|
application/x-shockwave-flash |
.tdf |
Application/x-tdf |
|
Application/x-tg4 |
.tga |
Application/x-tga |
|
Image/tiff |
.tif |
Application/x-tif |
|
Image/tiff |
.tld |
Text/xml |
|
Drawing/x-top |
.torrent |
application/x-bittorrent |
|
Text/xml |
.txt |
Text/plain |
|
Application/x-icq |
.uls |
Text/iuls |
|
Text/x-vcard |
.vda |
Application/x-vda |
|
application/vnd.visio |
.vml |
Text/xml |
|
Application/x-vpeg005 |
.vsd |
application/vnd.visio |
|
application/x-vsd |
.vss |
application/vnd.visio |
|
application/vnd.visio |
.vst |
Application/x-vst |
|
application/vnd.visio |
.vsx |
application/vnd.visio |
|
application/vnd.visio |
.vxml |
Text/xml |
|
Audio/wav |
.wax |
Audio/x-ms-wax |
|
Application/x-wb1 |
.wb2 |
Application/x-wb2 |
|
Application/x-wb3 |
.wbmp |
image/vnd.wap.wbmp |
|
Application/msword |
.wk3 |
Application/x-wk3 |
|
Application/x-wk4 |
.wkq |
Application/x-wkq |
|
application/x-wks |
.wm |
Video/x-ms-wm |
|
Audio/x-ms-wma |
.wmd |
Application/x-ms-wmd |
|
Application/x-wmf |
.wml |
text/vnd.wap.wml |
|
Video/x-ms-wmv |
.wmx |
Video/x-ms-wmx |
|
application/x-ms-wmz |
.wp6 |
Application/x-wp6 |
|
Application/x-wpd |
.wpg |
Application/x-wpg |
|
application/vnd.ms-wpl |
.wq1 |
Application/x-wq1 |
|
Application/x-wr1 |
.wri |
Application/x-wri |
|
application/x-wrk |
.ws |
Application/x-ws |
|
Application/x-ws |
.wsc |
Text/scriptlet |
|
Text/xml |
.wvx |
video/x-ms-wvx |
|
application/vnd.adobe.xdp |
.xdr |
Text/xml |
|
application/vnd.adobe.xfd |
.xfdf |
application/vnd.adobe.xfdf |
|
Text/html |
.xls |
Application/vnd.ms-excel |
|
Application/x-xls |
.xlw |
Application/x-xlw |
|
Text/xml |
.xpl |
Audio/scpls |
|
Text/xml |
.xql |
Text/xml |
|
Text/xml |
.xsd |
Text/xml |
|
Text/xml |
.xslt |
Text/xml |
|
application/x-xwd |
.x_b |
Application/x-x_b |
|
application/vnd.symbian.install |
.sisx |
application/vnd.symbian.install |
|
Application/x-x_t |
.ipa |
application/vnd.iphone |
|
Application/vnd.android.package-archive |
.xap |
Application/x-silverlight-app |