Display JPEG using Response.BinaryWrite

*爱你&永不变心* 提交于 2019-12-01 11:14:07

FSO cannot load a binary file, only text. You will need to use a 3th party component.

To read and output binary you can simply use the ADODB.Stream object.

See the ADODB.Stream MSDN Library:
http://msdn.microsoft.com/en-us/library/ms675032(VS.85).aspx

Here's an example I found from Experts Exchange as well:

Function ReadBinaryFile(strFileName) 
        on error resume next 
        Set oStream = Server.CreateObject("ADODB.Stream") 
        if Err.Number <> 0 then 
                ReadBinaryFile=Err.Description 
                Err.Clear 
                exit function 
        end if 
        oStream.Type = 1  
        oStream.Open 

        oStream.LoadFromFile strFileName 
        if Err.Number<>0 then 
                ReadBinaryFile=Err.Description 
                Err.Clear 
                exit function 
        end if 
        ReadBinaryFile=oStream.Read 
        oStream.Close 
        set oStream = nothing 
        if Err.Number<>0 then ReadBinaryFile=Err.Description 
End Function  

you can just redirect your counter.asp to the image you want..

<%
response.redirect("/virtual/path/to/yourimage.jpg")
%>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!