流(stream)技术做下载
``` function dl(f,n) on error resume next Set S=CreateObject("Adodb.Stream") S.Mode=3 S.Type=1 S.Open S.LoadFromFile(f) if Err.Number>0 then Response.Status="404" else Response.ContentType="application/octet-stream" Response.AddHeader "Content-Disposition:","attachment; filename=" & n Range=Mid(Request.ServerVariables("HTTP_RANGE"),7) if Range="" then Response.BinaryWrite(S.Read) else S.position=Clng(Split(Range,"-")(0)) Response.BinaryWrite(S.Read) End if end if Response.End end function '函数使用示例: call dl(Server.MapPath("../download/07.zip"),"07.zip") ```
asp代码
声明:本站部分文章,来源于互联网收集分享。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
转载本文注明出处:http://www.suuxx.com/blog/a/004A3BD30AEE6E3D.html
留言评论