图片不进行处理,图片默认是用浏览器打开显示,如果希望图片变为下载可以使用以下代码

function downloadFile(strFile)
    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("<h1>Error:</h1>" & strFilename & " does not exist<p>")
        Response.End
    end if
 
    Set f = fso.GetFile(strFilename)
    intFilelength = f.size
 
    s.LoadFromFile(strFilename)
    if err then
        Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
        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
End Function

以上所述就是本文给大家分享的函数了,希望对大家学习asp能够有所帮助。

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com