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
%>