首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

asp有关问题:上载时怎么更换文件名

2012-08-07 
asp问题:下载时如何更换文件名譬如下载链接为 http://zhidao.baidu.com/aaa.doc 我希望下载到桌面的是

asp问题:下载时如何更换文件名
譬如下载链接为 " http://zhidao.baidu.com/aaa.doc "
我希望下载到桌面的是 " 中国.doc "

请高手指点,具体代码最好 3Q

[解决办法]
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

热点排行