首页 > 代码库 > Mime类型与文件后缀对照表及探测文件MIME的方法
Mime类型与文件后缀对照表及探测文件MIME的方法
说明:刚刚写了一篇《IHttpHandler的妙用(2):防盗链!我的资源只有我的用户才能下载》的文章,网址:http://blog.csdn.net/zhoufoxcn/archive/2008/01/11/2036995.aspx。估计很多朋友对不同后缀的文件对应的MIME类型不熟悉(实际上这么多我也记不住),所以将平常常见的一些文件后缀对应的MIME类型写了一个对照表,现在奉献给大家:
文件后缀 | MIME | 备注 |
*.avi | video/x-msvideo | 视频文件 |
*.aif *.aiff *.aifc | audio/x-aiff | 声音文件 |
*.au *.snd | audio/basic | 声音文件 |
*.ai *.eps *.ps | application/postscript | |
*.asd *.asn | application/astound | |
*.bin *.exe *.com *.dll *.class | application/octet-stream | 二进制数据文件 |
*.bin | application/x-macbinary | |
*.csv | text/comma-separated-values | |
*.css | text/css | Css(样式表文件) |
*.dwg | application/acad | AutoCAD文件 |
*.dxf | application/dxf | AutoCAD文件 |
*.dcr *.dir *.dxr | application/x-director | |
*.doc *.dot | application/msword | Word类型文件 |
*.gz | application/gzip | GNU 压缩格式文件 |
*.gif | image/gif | |
*.hlp *.chm | application/mshelp | |
*.htm *.html *.shtml | text/html | |
*.js | text/javascript | |
*.jpeg *.jpg *.jpe | image/jpeg | |
*.mpeg *.mpg *.mpe | video/mpeg | |
*.mp3 | audio/mpeg | |
*.qt *.mov | video/quicktime | |
*.mdb | application/msaccess | |
*.ppt *.ppz *.pps *.pot | application/mspowerpoint | |
*.pdf | application/pdf | |
*.rar | application/octet-stream | |
*.rtf | application/rtf | |
*.rtx | text/richtext | |
*.ram *.ra | audio/x-pn-realaudio | |
*.rm *.rmvb | application/vnd.rn-realmedia | |
*.swf *.cab | application/x-shockwave-flash | |
* . txt | text/plain | |
*.xls *.xla | application/msexcel | |
*.z | application/x-compress | |
*.zip | application/x-zip-compressed |
protected void btnUpload_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
Response.Write("MIME=" + FileUpload1.PostedFile.ContentType);
}
}
{
if (FileUpload1.HasFile)
{
Response.Write("MIME=" + FileUpload1.PostedFile.ContentType);
}
}
本文出自 “周公(周金桥)的专栏” 博客,请务必保留此出处http://zhoufoxcn.blog.51cto.com/792419/167035
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。