ASP源码
PHP源码
.NET源码
JSP源码
<%
' 下载文件
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
%>