为什么我的机器下载word文档是直接打开的?

zou_cz 2003-12-08 09:51:26
为什么我的机器下载word文档是直接打开的?
...全文
116 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lovedogdog 2003-12-09
  • 打赏
  • 举报
回复
用这个直接下载,稍微改下程序就可以
dim StrFile,StrFilename
dim IntFilelength
dim Range,length
dim s,f
dim ErrNo,ErrDes

StrFile=request.QueryString.Item("filename")
if StrFile = "" then
response.Redirect "message.asp?ErrNo=3"

else
StrFilename = server.MapPath(StrFile)
if instr(StrFilename,"\temp\") then
else
response.Redirect "message.asp?ErrNo=0&ErrDes=" & StrFile
end if
'Response.Buffer = True
'Response.Clear
Set s = Server.CreateObject("ADODB.Stream")
s.Type = 1
s.Mode=3
s.Open
on error resume next
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
set fso=nothing
s.close
set s= nothing
response.Redirect "message.asp?ErrNo=0"
end if

Set f = fso.GetFile(strFilename)
IntFilelength = f.size
s.LoadFromFile(strFilename)
if err then
set fso=nothing
s.close
set s= nothing
set f=nothing
ErrNo = Err.Number
ErrDes = Err.Description
response.Redirect "message.asp?ErrNo=" & ErrNo & "&ErrDes=Download<br>" & ErrDes
end if
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=" &f.name
Response.CharSet = "UTF-8"
Range=Mid(Request.ServerVariables("HTTP_RANGE"),7)
if Range<>"" then
length=Clng(Split(Range,"-")(0))
intFilelength=intFilelength-length
s.position=length
end if
Response.AddHeader "Content-Length", intFilelength
Response.BinaryWrite s.Read
'Response.Flush
s.Close
set fso=nothing
set f=nothing
Set s = Nothing

end if
yassee 2003-12-09
  • 打赏
  • 举报
回复
用flashget当。
zou_cz 2003-12-09
  • 打赏
  • 举报
回复
如何设置 ie 使他下载doc文档时不直在ie内接打开
xiaoyuehen 2003-12-08
  • 打赏
  • 举报
回复
你可以用右键另存为。。。
zou_cz 2003-12-08
  • 打赏
  • 举报
回复
如何不直接打开
whb147 2003-12-08
  • 打赏
  • 举报
回复
那是因为你装了word呀,
你可以用右键呀
DeltaCat 2003-12-08
  • 打赏
  • 举报
回复
搜 “下载服务器文件”,可以找到很多答案的

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧