Note: I just wrote an article titled ihttphandler (2): anti-leech! My resources can only be downloaded by my users. The URL is http://blog.csdn.net/zhoufoxcn/archive/2008/01/11/2018.5.aspx. It is estimated that many friends are not familiar with the MIME types corresponding to files with different suffixes (in fact, I cannot remember so many ), therefore, I have written a table of MIME types corresponding to some common file suffixes, And I will present them to you:
File suffix |
Mime |
Remarks |
*.avi |
video/x-msvideo |
Video Files |
*.aif *.aiff *.aifc |
audio/x-aiff |
Sound file |
*.au *.snd |
audio/basic |
Sound file |
*.ai *.eps *.ps |
application/postscript |
|
*.asd *.asn |
application/astound |
|
*.bin *.exe *.com *.dll *.class |
application/octet-stream |
Binary data file |
*.bin |
application/x-macbinary |
|
*.csv |
text/comma-separated-values |
|
*.css |
text/css |
CSS (style sheet file) |
*.dwg |
application/acad |
AutoCAD File |
*.dxf |
application/dxf |
AutoCAD File |
*.dcr *.dir *.dxr |
application/x-director |
|
*.doc *.dot |
application/msword |
Word Files |
*.gz |
application/gzip |
GNU compressed file |
*.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 |
|
Note: The comparison between commonly used file formats and Mime is listed above. If you encounter uncommon file formats during actual development, you do not need to worry about them, use the fileupload component of Asp.net to easily drag a fileupload component to the web form and add a button. The Click Event code of the button is as follows:
Protected void btnupload_click (Object sender, eventargs E)
{
If (fileupload1.hasfile)
{
Response. Write ("mime =" + fileupload1.postedfile. contenttype );
}
.
This article is from the "Zhou Gong (Zhou Jinqiao) column" blog, please be sure to keep this source http://zhoufoxcn.blog.51cto.com/792419/167035