[Quote=引用 3 楼 cosler 的回复:]
function download(f,n)
'f文件全路径,n下载文件的文件名
on error resume next
Set S=CreateObject("Adodb.Stream")
S.Mode=3
S.Type=1
S.Open
S.LoadFromFile(f)
if Err.Number>0 then……
[/Quote]
高人,我做了如下修改,但提示不成功,只执行到“if Err.Number>0 then”这就不行了,劳烦看看哇
Function download(f,n)
'f文件全路径,n下载文件的文件名
on error resume next
Set S=CreateObject("Adodb.Stream")
S.Mode=3
S.Type=1
S.Open
S.LoadFromFile(f)
response.Write "1"
if Err.Number>0 then
response.Write "4"
Response.status="404"
else
Response.ContentType="application/octet-stream"
Response.AddHeader "Content-Disposition:","Attachment;filename="&n
if Range="" then
response.Write "2"
Response.BinaryWrite(S.Read)
else
response.Write "3"
S.Postion=Clng(Split(Range,"-")(0))
Response.BinaryWrite(S.Read)
end if
End if
Response.end
end function
if request.QueryString("Path")<>"" and request.QueryString("FileTitle")<>"" then
response.Write request.QueryString("Path")
response.Write request.QueryString("FileTitle")
call download(request("Path"),request("FileTitle"))
end if
%>
<a href="?Path=http://192.168.0.1/oa/2011-8/201081614014916.doc&FileTitle=信息交流">下载</a>
function download(f,n)
'f文件全路径,n下载文件的文件名
on error resume next
Set S=CreateObject("Adodb.Stream")
S.Mode=3
S.Type=1
S.Open
S.LoadFromFile(f)
if Err.Number>0 then
Response.status="404"
else
Response.ContentType="application/octet-stream"
Response.AddHeader "Content-Disposition:","Attachment;filename="&n
if Range="" then
Response.BinaryWrite(S.Read)
else
S.Postion=Clng(Split(Range,"-")(0))
Response.BinaryWrite(S.Read)
end if
End if
Response.end
end function
if request("Path")<>"" and request("Name")<>"" then
call download(request("Path"),request("Name"))
end if
function download(f,n)
'f文件全路径,n下载文件的文件名
on error resume next
Set S=CreateObject("Adodb.Stream")
S.Mode=3
S.Type=1
S.Open
S.LoadFromFile(f)
if Err.Number>0 then
Response.status="404"
else
Response.ContentType="application/octet-stream"
Response.AddHeader "Content-Disposition:","Attachment;filename="&n
if Range="" then
Response.BinaryWrite(S.Read)
else
S.Postion=Clng(Split(Range,"-")(0))
Response.BinaryWrite(S.Read)
end if
End if
Response.end
end function
if request("Path")<>"" and request("Name")<>"" then
call download(request("Path"),request("Name"))
end if