濮阳杆衣贸易有限公司

主頁 > 知識庫 > ASP實現(xiàn)文件直接下載的代碼

ASP實現(xiàn)文件直接下載的代碼

熱門標(biāo)簽:地圖標(biāo)注服務(wù)哪家好 西寧公司外呼系統(tǒng)平臺 智能電銷機(jī)器人適用于哪些行業(yè) 騰訊地圖標(biāo)注商戶關(guān)閉 武漢營銷電話機(jī)器人軟件 地圖標(biāo)注宅基地 外呼系統(tǒng)還用卡么 長沙防封電銷卡品牌 徐州人工智能電銷機(jī)器人好用嗎
%@ language=vbscript codepage=65001%>
%
'Filename must be input
if Request("Filename")="" then
response.write "h1>Error:/h1>Filename is empty!p>"
else
call downloadFile(replace(replace(Request("Filename"),"\",""),"/",""))

Function downloadFile(strFile)
' make sure you are on the latest MDAC version for this to work
' get full path of specified file
strFilename = server.MapPath(strFile)

' clear the buffer
Response.Buffer = True
Response.Clear

' create stream
Set s = Server.CreateObject("ADODB.Stream")
s.Open

' Set as binary
s.Type = 1

' load in the file
on error resume next

' check the file exists
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("h1>Error:/h1>"strFilename" does not exists!p>")
Response.End
end if

' get length of file
Set f = fso.GetFile(strFilename)
intFilelength = f.size

s.LoadFromFile(strFilename)
if err then
Response.Write("h1>Error: /h1>Unknown Error!p>")
Response.End
end if
' send the headers to the users Browse
Response.AddHeader "Content-Disposition","attachment; filename="f.name
Response.AddHeader "Content-Length",intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
' output the file to the browser
Response.BinaryWrite s.Read
Response.Flush
' tidy up
s.Close
Set s = Nothing
End Function
end if
%>

標(biāo)簽:運(yùn)城 雅安 普洱 巴彥淖爾 荊門 鷹潭 通遼 通化

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ASP實現(xiàn)文件直接下載的代碼》,本文關(guān)鍵詞  ASP,實現(xiàn),文件,直接,下載,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ASP實現(xiàn)文件直接下載的代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于ASP實現(xiàn)文件直接下載的代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    东海县| 祁连县| 外汇| 金川县| 兴和县| 盐亭县| 房山区| 新干县| 永丰县| 梨树县| 隆化县| 海安县| 寿宁县| 江达县| 东安县| 句容市| 仁怀市| 凌源市| 富宁县| 治县。| 资源县| 天祝| 文成县| 郁南县| 工布江达县| 马龙县| 库伦旗| 周宁县| 余姚市| 潮安县| 黄山市| 浦东新区| 静安区| 八宿县| 淅川县| 柘荣县| 临夏县| 吉首市| 故城县| 山东省| 合作市|