关于下载的问题,急!!!
再下載文件時,在若網路設有防火牆,則網頁會顯示【無法顯示此頁】,怎麼辦?請路過大俠指引.急!急!急!!
下載文件:
<%
strFile="c_comp.exe"
call downloadFile(strFile)
function downloadFile(strFile)
strFilename = server.MapPath(strFile)
Response.Buffer = True
Response.Clear
Set fso=Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("沒找到文件")
Response.End
end if
Set fl=fso.getfile(strFilename)
flsize=fl.size
flName=fl.name
Set fl=Nothing
Set fso=Nothing
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilename
Response.AddHeader "Content-Disposition", "attachment; filename=" & flName
Response.AddHeader "Content-Length", flsize
Response.Charset = "big5"
Response.ContentType = "application/unknow"
Response.BinaryWrite objStream.Read
Response.Flush
response.Clear()
objStream.Close
Set objStream = Nothing
End Function
%>
[ 本帖最后由 wanghua09 于 2009-11-4 19:36 编辑 ]