asp用adodb.stream读取服务器上的图片通过浏览器以文件流的形式输出

<%

function openJpeg(filename)
dim stream
set stream = Server.CreateObject("ADODB.Stream")
stream.mode = 3 '1-读,2-写,3-读写
stream.type = 1 '1-二进制,2-文本
stream.Open
stream.LoadFromFile FileName        
openJpeg = stream.Read()
stream.Close
end function

filename = "photo/"+request.queryString("filename")+".jpg"
Dim path,jpegdata  
path = server.mappath(filename)  
response.write(path)
jpegdata = openJpeg(path)      
Response.ContentType = "image/jpeg" 
Response.Buffer = True 
Response.Clear 
Response.BinaryWrite jpegdata 
Response.Flush
%>

 

http://...../..asp?filename=图片名

你可能感兴趣的:(Stream,function,浏览器,服务器,asp,Path)