<% Dim Fso,FileExt,strFilePath,Mime strFilePath = "f:\sifang\qyoa\国贸手抄.doc" Set Fso=Server.CreateObject("Scripting.FileSystemObject")
<%
Dim Fso,FileExt,strFilePath,Mime
strFilePath = "f:\sifang\qyoa\国贸手抄.doc"
Set Fso=Server.CreateObject("Scripting.FileSystemObject")
FileExt = Fso.GetExtensionName(strFilePath)
Set fso=Nothing
Select Case FileExt
Case "doc"
Mime="Application/msword"
Case "xls"
Mime="Application/msexcel"
End Select
Call OutPut(strFilePath,Mime)
'######################################################
Function OutPut(strFilePath,Mime)
Response.ContentType = Mime
Const adTypeBinary = 1
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
End Function
'######################################################
%>
附MIME类型表
序号 | 内容类型 | 文件扩展名 | 描述 |
1 | application/msword | doc | Microsoft Word |
2 | application/octet-stream bin | dms lha lzh exe class | 可执行程序 |
3 | application/pdf | pdf | Adobe Acrobat |
4 | application/postscript | ai eps ps | PostScript |
5 | appication/powerpoint | ppt | Microsoft Powerpoint |
6 | appication/rtf | rtf | rtf格式 |
7 | appication/x-compress | z | unix压缩文件 |
8 | application/x-gzip | gz | gzip |
9 | application/x-gtar | gtar | tar文档(gnu格式) |
10 | application/x-shockwave-flash | swf | MacroMedia Flash |
11 | application/x-tar | tar | tar(4.3BSD) |
12 | application/zip | zip | winzip |
13 | audio/basic | au snd | sun/next 声音文件 |
14 | audio/mpeg | mpeg mp2 | Mpeg声音文件 |
15 | audio/x-aiff | mid midi rmf | Midi格式 |
16 | audio/x-pn-realaudio | ram ra | Real Audio声音 |
17 | audio/x-pn-realaudio-plugin | rpm | Real Audio插件 |
18 | audio/x-wav | wav | Microsoft Windows声音 |
19 | image/cgm | cgm | 计算机图形元文件 |
20 | image/gif | gif | COMPUSERVE GIF图像 |
21 | image/jpeg | jpeg jpg jpe | JPEG图像 |
22 | image/png | png | PNG图像 |
23 | image/tiff | tiff tif | TIFF图像 |
24 | image/x-pict | pic | MACINTOSH PICT图像 |
25 | text/css | css | CSS风格纸 |
26 | text/html | html htm | HTML文档 |
27 | text/javascript | js ls mocha | JAVASCRIPT脚本 |
28 | text/plain | txt | ASCII文本 |
29 | text/richtext | rtx | MICROSOFT RICH TEXT |
30 | text/tab-separated-values | tsv | TAB-SEPARATED VALUE |
31 | text/vbscript | vbx | VISUAL BASIC脚本 |
32 | text/sgml | sgml sgm | SGML文本 |
33 | video/mpeg | mpeg mpg mpe | MPEG影像 |
34 | video/quicktime | qt mov | QUICKTIME视频 |
35 | video/x-msvideo | avi | WINDOWS(AVI)视频 |
36 | x-video/x-vrml | wrl vrml | Vrml |
原标题:ASP输出WOrd、Excel文件!
关键词:ASP
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。