特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP教程> ASP使用流输出文件下载

ASP使用流输出文件下载

时间:2009-06-26 18:06:07 作者:互联网

<%
' 下载文件
function downloadfile(fullpath)

downloadfile = false

dim strfilename, s, fso, f, intfilelength

set fso = se***r.createobject("sc***ting.filesystemobject")

if not fs***ileexists(fullpath) then


exit function

end if

set f = fs***etfile(fullpath)

'获取文件大小

intfilelength = f.size

set s = se***r.createobject("ad***.stream")

s.open

s.type = 1

s.***dfromfile(fullpath)

re***nse.buffer = true

re***nse.clear

're***nse.addheader "Content-Encoding","GB2312" ' 乱码的解决方案

're***nse.addheader "content-type","application/x-msdownload"

re***nse.addheader "content-disposition","attachment;filename=" & f.name

re***nse.addheader "content-length" ,intfilelength

re***nse.contenttype = "application/octet-stream"

while not s.eos


re***nse.binarywrite s.read(1024 * 64)


re***nse.flush

wend

s.close

set s = nothing

downloadfile = true
end function
%>

相关文章 最新文章

相关应用

热门文章

猜你喜欢

返回顶部