<%
' 下载文件
função downloadfile (caminho completo)
downloadfile = false
dim strfilename, s, fso, f, intfilelength
set fso = server.createobject("scripting.filesystemobject")
se não for fso.fileexists(fullpath) então
função de saída
fim se
definido f = fso.getfile(fullpath)
'获取文件大小
intfilelength = f.size
set s = server.createobject("adodb.stream")
s.open
s.type = 1
s.loadfromfile(fullpath)
resposta .buffer = true
resposta.clear
'response.addheader "Codificação de conteúdo","GB2312" ' 乱码的解决方案
'response.addheader "tipo de conteúdo","aplicativo/x-msdownload"
resposta.addheader "disposição de conteúdo" ,"attachment;filename=" & f.name
response.addheader "content-length" ,intfilelength
response.contenttype = "application/octet-stream"
enquanto não s.eos
resposta.binarywrite s.read(1024 * 64)
resposta.flush
wend
s.close
set s = nada
downloadfile = true
função final
%>