當前位置:編程學習大全網 - 網站源碼 - ASP下載更改文件名和生成文件的問題

ASP下載更改文件名和生成文件的問題

ASP使用流輸出文件下載

這裏的fullpath就是妳的輸出文件具體的完整路徑

function downloadfile(fullpath)

downloadfile = false

dim strfilename, s, fso, f, intfilelength

set fso = server.createobject("scripting.filesystemobject")

if not fso.fileexists(fullpath) then

exit function

end if

set f = fso.getfile(fullpath)

'獲取文件大小

intfilelength = f.size

set s = server.createobject("adodb.stream")

s.open

s.type = 1

s.loadfromfile(fullpath)

response.buffer = true

response.clear

'response.addheader "content-type","application/x-msdownload"

response.addheader "content-disposition","attachment;filename=" & f.name

response.addheader "content-length" ,intfilelength

response.contenttype = "application/octet-stream"

while not s.eos

response.binarywrite s.read(1024 * 64)

response.flush

wend

s.close

set s = nothing

downloadfile = true

end function

  • 上一篇:gitlab授權其他用戶拉代碼
  • 下一篇:關於易語言如何判斷網頁正在訪問的地址
  • copyright 2024編程學習大全網