Hi Again,
Yes I did test that code and its working
Well have look at these
This file
1.) img.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
database = Server.MapPath("DATABASE.mdb")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open database
SQL = "SELECT * FROM Files WHERE FileID = 3"
Set Rs = conn.Execute(SQL)
Response.BinaryWrite Rs("BinaryData").GetChunk(Rs("BinaryData").ActualSize)
%>
2.) imageDis.asp
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>For Help</title>
</head>
<body>
<img src="img.asp" />
</body>
</html>
3.) img1.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
database = Server.MapPath("DATABASE.mdb")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open database
Dim SQL
Dim FileID
FileID = 4
SQL = "SELECT * FROM Files WHERE FileID = " & FileID
Set Rs = conn.Execute(SQL)
If Not Rs.EOF Then
Response.AddHeader "content-disposition", "inline; filename=" & oRs("FileName")
Response.AddHeader "content-length", Rs("BinaryData").ActualSize
Response.ContentType = Rs("ContentType")
Response.BinaryWrite Rs("BinaryData")
Else
Response.Write("File could not be found")
End If
%>
Examples:
This file will give output in ASCII codes
1.)
http://www.katarey.com/forhelp/img.asp
And this file will show the image,
2.)
http://www.katarey.com/forhelp/imageDis.asp
I hope This file that you want!
3.)
http://www.katarey.com/forhelp/img1.asp
I hope this will helpful for you, please feel free to ask question if any
Thanks
Regards,
Rahul Dev
Last edited by tgreer : Nov 3rd, 2006 at 3:29 pm. Reason: Removed unnecessary quote block.