I am using the file.asp to try and show an image that I have uploaded into a image datatype field. The contenttype = image/pjpeg, but all I get is the box with a red X...
Here is the code I am using for file.asp...
<!--#include file="../../Includes/AccessConnection.asp"-->
<%
' -- file.asp --
' Retrieves binary files from the database
Response.Buffer = True
' ID of the file to retrieve
Dim ID
ID = Request("ID")
If Len(ID) < 1 Then
ID = 7
End If
' Connection String
' Recordset Object
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
' opening connection
rs.Open "select Photo, contenttype from tblpkscripts where uniqueID = " & _
ID, conn, 2, 4
If Not rs.EOF Then
Response.ContentType = rs("ContentType")
Response.BinaryWrite rs("photo")
End If
rs.Close
Set rs = Nothing
%>
The form field on the other page is as so...
<TR align=center>
<TD colspan=2>
<STRONG> Photo:</STRONG>
<img src=""file.asp?ID=" & ID & """>
</TD>
</TR>
I am using SQL Server 2000... any suggestions???