Array of MIME Types


 / Published in: PHP
 

This is an associative array of nearly every common MIME type. It's useful when you need to serve a file for download but you don't know the correct content type. You can look it up using it's extension.

  1. $mime_types = array("323" => "text/h323",
  2. "acx" => "application/internet-property-stream",
  3. "ai" => "application/postscript",
  4. "aif" => "audio/x-aiff",
  5. "aifc" => "audio/x-aiff",
  6. "aiff" => "audio/x-aiff",
  7. "asf" => "video/x-ms-asf",
  8. "asr" => "video/x-ms-asf",
  9. "asx" => "video/x-ms-asf",
  10. "au" => "audio/basic",
  11. "avi" => "video/x-msvideo",
  12. "axs" => "application/olescript",
  13. "bas" => "text/plain",
  14. "bcpio" => "application/x-bcpio",
  15. "bin" => "application/octet-stream",
  16. "bmp" => "image/bmp",
  17. "c" => "text/plain",
  18. "cat" => "application/vnd.ms-pkiseccat",
  19. "cdf" => "application/x-cdf",
  20. "cer" => "application/x-x509-ca-cert",
  21. "class" => "application/octet-stream",
  22. "clp" => "application/x-msclip",
  23. "cmx" => "image/x-cmx",
  24. "cod" => "image/cis-cod",
  25. "cpio" => "application/x-cpio",
  26. "crd" => "application/x-mscardfile",
  27. "crl" => "application/pkix-crl",
  28. "crt" => "application/x-x509-ca-cert",
  29. "csh" => "application/x-csh",
  30. "css" => "text/css",
  31. "dcr" => "application/x-director",
  32. "der" => "application/x-x509-ca-cert",
  33. "dir" => "application/x-director",
  34. "dll" => "application/x-msdownload",
  35. "dms" => "application/octet-stream",
  36. "doc" => "application/msword",
  37. "dot" => "application/msword",
  38. "dvi" => "application/x-dvi",
  39. "dxr" => "application/x-director",
  40. "eps" => "application/postscript",
  41. "etx" => "text/x-setext",
  42. "evy" => "application/envoy",
  43. "exe" => "application/octet-stream",
  44. "fif" => "application/fractals",
  45. "flr" => "x-world/x-vrml",
  46. "gif" => "image/gif",
  47. "gtar" => "application/x-gtar",
  48. "gz" => "application/x-gzip",
  49. "h" => "text/plain",
  50. "hdf" => "application/x-hdf",
  51. "hlp" => "application/winhlp",
  52. "hqx" => "application/mac-binhex40",
  53. "hta" => "application/hta",
  54. "htc" => "text/x-component",
  55. "htm" => "text/html",
  56. "html" => "text/html",
  57. "htt" => "text/webviewhtml",
  58. "ico" => "image/x-icon",
  59. "ief" => "image/ief",
  60. "iii" => "application/x-iphone",
  61. "ins" => "application/x-internet-signup",
  62. "isp" => "application/x-internet-signup",
  63. "jfif" => "image/pipeg",
  64. "jpe" => "image/jpeg",
  65. "jpeg" => "image/jpeg",
  66. "jpg" => "image/jpeg",
  67. "js" => "application/x-javascript",
  68. "latex" => "application/x-latex",
  69. "lha" => "application/octet-stream",
  70. "lsf" => "video/x-la-asf",
  71. "lsx" => "video/x-la-asf",
  72. "lzh" => "application/octet-stream",
  73. "m13" => "application/x-msmediaview",
  74. "m14" => "application/x-msmediaview",
  75. "m3u" => "audio/x-mpegurl",
  76. "man" => "application/x-troff-man",
  77. "mdb" => "application/x-msaccess",
  78. "me" => "application/x-troff-me",
  79. "mht" => "message/rfc822",
  80. "mhtml" => "message/rfc822",
  81. "mid" => "audio/mid",
  82. "mny" => "application/x-msmoney",
  83. "mov" => "video/quicktime",
  84. "movie" => "video/x-sgi-movie",
  85. "mp2" => "video/mpeg",
  86. "mp3" => "audio/mpeg",
  87. "mpa" => "video/mpeg",
  88. "mpe" => "video/mpeg",
  89. "mpeg" => "video/mpeg",
  90. "mpg" => "video/mpeg",
  91. "mpp" => "application/vnd.ms-project",
  92. "mpv2" => "video/mpeg",
  93. "ms" => "application/x-troff-ms",
  94. "mvb" => "application/x-msmediaview",
  95. "nws" => "message/rfc822",
  96. "oda" => "application/oda",
  97. "p10" => "application/pkcs10",
  98. "p12" => "application/x-pkcs12",
  99. "p7b" => "application/x-pkcs7-certificates",
  100. "p7c" => "application/x-pkcs7-mime",
  101. "p7m" => "application/x-pkcs7-mime",
  102. "p7r" => "application/x-pkcs7-certreqresp",
  103. "p7s" => "application/x-pkcs7-signature",
  104. "pbm" => "image/x-portable-bitmap",
  105. "pdf" => "application/pdf",
  106. "pfx" => "application/x-pkcs12",
  107. "pgm" => "image/x-portable-graymap",
  108. "pko" => "application/ynd.ms-pkipko",
  109. "pma" => "application/x-perfmon",
  110. "pmc" => "application/x-perfmon",
  111. "pml" => "application/x-perfmon",
  112. "pmr" => "application/x-perfmon",
  113. "pmw" => "application/x-perfmon",
  114. "pnm" => "image/x-portable-anymap",
  115. "pot" => "application/vnd.ms-powerpoint",
  116. "ppm" => "image/x-portable-pixmap",
  117. "pps" => "application/vnd.ms-powerpoint",
  118. "ppt" => "application/vnd.ms-powerpoint",
  119. "prf" => "application/pics-rules",
  120. "ps" => "application/postscript",
  121. "pub" => "application/x-mspublisher",
  122. "qt" => "video/quicktime",
  123. "ra" => "audio/x-pn-realaudio",
  124. "ram" => "audio/x-pn-realaudio",
  125. "ras" => "image/x-cmu-raster",
  126. "rgb" => "image/x-rgb",
  127. "rmi" => "audio/mid",
  128. "roff" => "application/x-troff",
  129. "rtf" => "application/rtf",
  130. "rtx" => "text/richtext",
  131. "scd" => "application/x-msschedule",
  132. "sct" => "text/scriptlet",
  133. "setpay" => "application/set-payment-initiation",
  134. "setreg" => "application/set-registration-initiation",
  135. "sh" => "application/x-sh",
  136. "shar" => "application/x-shar",
  137. "sit" => "application/x-stuffit",
  138. "snd" => "audio/basic",
  139. "spc" => "application/x-pkcs7-certificates",
  140. "spl" => "application/futuresplash",
  141. "src" => "application/x-wais-source",
  142. "sst" => "application/vnd.ms-pkicertstore",
  143. "stl" => "application/vnd.ms-pkistl",
  144. "stm" => "text/html",
  145. "svg" => "image/svg+xml",
  146. "sv4cpio" => "application/x-sv4cpio",
  147. "sv4crc" => "application/x-sv4crc",
  148. "t" => "application/x-troff",
  149. "tar" => "application/x-tar",
  150. "tcl" => "application/x-tcl",
  151. "tex" => "application/x-tex",
  152. "texi" => "application/x-texinfo",
  153. "texinfo" => "application/x-texinfo",
  154. "tgz" => "application/x-compressed",
  155. "tif" => "image/tiff",
  156. "tiff" => "image/tiff",
  157. "tr" => "application/x-troff",
  158. "trm" => "application/x-msterminal",
  159. "tsv" => "text/tab-separated-values",
  160. "txt" => "text/plain",
  161. "uls" => "text/iuls",
  162. "ustar" => "application/x-ustar",
  163. "vcf" => "text/x-vcard",
  164. "vrml" => "x-world/x-vrml",
  165. "wav" => "audio/x-wav",
  166. "wcm" => "application/vnd.ms-works",
  167. "wdb" => "application/vnd.ms-works",
  168. "wks" => "application/vnd.ms-works",
  169. "wmf" => "application/x-msmetafile",
  170. "wps" => "application/vnd.ms-works",
  171. "wri" => "application/x-mswrite",
  172. "wrl" => "x-world/x-vrml",
  173. "wrz" => "x-world/x-vrml",
  174. "xaf" => "x-world/x-vrml",
  175. "xbm" => "image/x-xbitmap",
  176. "xla" => "application/vnd.ms-excel",
  177. "xlc" => "application/vnd.ms-excel",
  178. "xlm" => "application/vnd.ms-excel",
  179. "xls" => "application/vnd.ms-excel",
  180. "xlt" => "application/vnd.ms-excel",
  181. "xlw" => "application/vnd.ms-excel",
  182. "xof" => "x-world/x-vrml",
  183. "xpm" => "image/x-xpixmap",
  184. "xwd" => "image/x-xwindowdump",
  185. "z" => "application/x-compress",
  186. "zip" => "application/zip");

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: fireinthebelly on August 23, 2009

Good work, thanks

Posted By: murdaugh on July 15, 2012

This is excellent - but it seems to be missing: image/png

You need to login to post a comment.