页面链接: ASP下载图片而不是在网页中打开的解决方法打开 下载 loadown.asp: <% strFile=Trim(Request.QueryString("filename")) if strFile="" or isnull(strFile) then Response.Write("") Response.End end if strFilename = server.MapPath(strFile) Response.Buffer = True Response.Clear Set s = Server.CreateObject("ADODB.Stream") s.Open s.Type = 1 on error resume next Set fso = Server.CreateObject("Scripting.FileSystemObject") if not fso.FileExists(strFilename) then Response.Write("

Error:" & strFilename & " 文件不存在

") Response.End end if Set f = fso.GetFile(strFilename) intFilelength = f.size s.LoadFromFile(strFilename) if err then Response.Write("

Error:" & err.Description & "

") Response.End end if Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name Response.AddHeader "Content-Length", intFilelength Response.CharSet = "UTF-8" Response.ContentType = "application/octet-stream" Response.BinaryWrite s.Read Response.Flush s.Close Set s = Nothing %>

相关文章:

  • 2021-12-12
  • 2021-09-25
  • 2021-11-23
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-01-31
  • 2021-06-04
  • 2021-12-18
相关资源
相似解决方案