這裏的完整路徑是輸出文件的特定完整路徑。
函數下載文件(完整路徑)
downloadfile = false
dim strfilename,s,fso,f,intfilelength
set FSO = server . createobject(" scripting . file system object ")
如果不是fso.fileexists(完整路徑),則
退出功能
如果…就會結束
set f = fso.getfile(完整路徑)
獲取文件大小
intfilelength = f.size
set s = server . createobject(" adodb . stream ")
s.open
s.type = 1
s.loadfromfile(完整路徑)
response.buffer = true
響應.清除
response.addheader "內容類型","應用程序/x-msdownload "
response.addheader“內容-處置”、“附件;filename = " & ampf.name
response . add header " content-length ",intfilelength
response.contenttype = "應用程序/八位字節流"
而不是s.eos
response . binary write s . read(1024 * 64)
響應.刷新
行
關閉
設置s =無
downloadfile = true
結束功能