输出文件的下载
来源:互联网 发布:网络语cx是什么意思 编辑:程序博客网 时间:2024/05/01 07:56
<%
Response.Buffer = true
Response.Clear
dim url
Dim fso,fl,flsize
dim Dname
Dim objStream,ContentType,flName,isre,url1
'*********************************************调用时传入的下载文件名
Dname=trim(request("n"))
'******************************************************************
If Dname<>"" Then
'******************************下载文件存放的服务端目录
url=server.MapPath("/")&"/"&Dname
'***************************************************
End If
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fl=fso.getfile(url)
flsize=fl.size
flName=fl.name
Set fl=Nothing
Set fso=Nothing
%>
<%
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile url
Select Case lcase(Right(flName, 4))
Case ".asf"
ContentType = "video/x-ms-asf"
Case ".avi"
ContentType = "video/avi"
Case ".doc"
ContentType = "application/msword"
Case ".zip"
ContentType = "application/zip"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case ".wav"
ContentType = "audio/wav"
Case ".mp3"
ContentType = "audio/mpeg3"
Case ".mpg", "mpeg"
ContentType = "video/mpeg"
Case ".rtf"
ContentType = "application/rtf"
Case ".htm", "html"
ContentType = "text/html"
Case ".txt"
ContentType = "text/plain"
Case Else
ContentType = "application/octet-stream"
End Select
Response.AddHeader "Content-Disposition", "attachment; filename=" & flName
Response.AddHeader "Content-Length", flsize
Response.Charset = "UTF-8"
Response.ContentType = ContentType
Response.BinaryWrite objStream.Read
Response.Flush
response.Clear()
objStream.Close
Set objStream = Nothing
%>
- 输出文件的下载
- PHP实现的文件直接输出下载
- response输出文件的时候,解决迅雷下载的问题
- 动态生成的字符串输出xml文件并下载
- php对csv文件的读取,写入,输出下载操作
- php对csv文件的读取,写入,输出下载操作
- php对csv文件的读取,写入,输出下载操作
- ASP文件下载用流输出的函数
- php对csv文件的读取,写入,输出下载操作
- php对csv文件的读取,写入,输出下载操作
- C# response输出要下载的文件流到客户端
- 输出硬盘文件,提供下载
- 字符串输出形成下载文件
- 下载输出到CSV文件
- php强制下载文件、文件强制下载、输出强制下载
- ASP使用流输出文件下载
- ASP使用流输出文件下载
- struts2输出并下载excel文件
- 春节
- J2ME MIDP个人所得税计算小应用【附源码】
- Request.ServerVariables中变量意义.
- c&z studio成立,关于c&z
- 中国式报表,头大!
- 输出文件的下载
- Java加密和数字签名编程快速入门
- 试验 vs 实验
- 拷贝构造函数
- [ZT]理光R1V夜景拍摄技巧
- [ZT]如何拍摄好玻璃缸内的游鱼
- vlc学习计划(6)--网络数据流接收处理过程分析
- Oracle数据库中日期的计算方法
- [笔记]《Computer Architecture: A Quantitative Approach (2nd)》ch1-2