ASP提取任意文件二进制数据流下载,通常遇到做文件下载站点时要用到:
<%
StrName = server.MapPath("挂机锁.exe")
Response.Buffer = True
Response.Clear
Set ADO = Server.CreateObject("ADODB.Stream")
ADO.Open
ADO.Type = 1
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(StrName)
intFilelength = f.size
ADO.LoadFromFile(StrName)
Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.ContentType = "application/octet-stream"
Response.BinaryWrite ADO.Read
Response.Flush
%> |
文章作者
Nuclear'Atk
上次更新
2010-09-10
许可协议
Nuclear'Atk(核攻击)网络安全实验室版权所有,转载请注明出处。