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

ASP改變文件名和生成文件的問題

ASP使用流式輸出文件下載。

這裏的完整路徑是輸出文件的特定完整路徑。

函數下載文件(完整路徑)

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

結束功能

  • 上一篇:iframe每個頁面加載css js
  • 下一篇:企業用戶,在點擊CA登陸後,不跳出Ukey密碼輸入框,顯示“網頁無法顯示”,怎麽辦?
  • copyright 2024編程學習大全網