Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : ASP : ADO/ODBC : File.asp not showing image... Signup · Login
Author Thread
File.asp not showing image...
Posted in tutorial: Displaying Images from an Access Database using plain ASP
·  sjdev
User
Joined: 10 Jun 2003
Total Posts: 2
File.asp not showing image...
Posted: 10 Jun 2003
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???

Users Who Have Visited This Thread In Last 24 Hours
6 Visitors

Login
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.