主頁(yè) > 知識(shí)庫(kù) > ASP實(shí)現(xiàn)文件直接下載的代碼

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

熱門(mén)標(biāo)簽:地圖標(biāo)注服務(wù)哪家好 西寧公司外呼系統(tǒng)平臺(tái) 智能電銷(xiāo)機(jī)器人適用于哪些行業(yè) 騰訊地圖標(biāo)注商戶(hù)關(guān)閉 武漢營(yíng)銷(xiāo)電話機(jī)器人軟件 地圖標(biāo)注宅基地 外呼系統(tǒng)還用卡么 長(zhǎng)沙防封電銷(xiāo)卡品牌 徐州人工智能電銷(xiāo)機(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)城 雅安 普洱 巴彥淖爾 荊門(mén) 鷹潭 通遼 通化

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ASP實(shí)現(xiàn)文件直接下載的代碼》,本文關(guān)鍵詞  ASP,實(shí)現(xiàn),文件,直接,下載,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ASP實(shí)現(xiàn)文件直接下載的代碼》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于ASP實(shí)現(xiàn)文件直接下載的代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 企业400电话

    智能AI客服机器人
    15000

    在线订购

    合计11份范本:公司章程+合伙协议+出资协议+合作协议+股权转让协议+增资扩股协议+股权激励+股东会决议+董事会决议

    推薦文章