Showing an Image

Discussion in 'Classic ASP' started by davamon, Dec 13, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a site that is suppose to show an uploaded image to the customer. It doesn't. The site is imagestoart.com.

    Use the 'Place an Order' button on the left hand navigator bar. Go to the middle of the page and upload an image. You'll see that the image should show - the file name is rendered. The showimage code is below.

    Thank you

    -d
    _____________________________________________________
    <%
    Referer = Trim(Request.ServerVariables('HTTP_REFERER'))
    Connect= 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='_database/orders.mdb'
    Set rs = Server.CreateObject('adodb.recordset')
    Set db = Server.CreateObject('ADODB.Connection')
    db.Open Connect
    id=request.QueryString('ID')
    if id = '' then
    SQL = 'SELECT top 1 ThumbBlob, filename, filesize FROM IMAGES where description='' & session.SessionID & '' and hash = '' & session('hash') & '' order by dateuploaded desc'
    else
    SQL = 'SELECT top 1 ThumbBlob, filename, filesize FROM IMAGES where description='' & session.SessionID & '' and hash = '' & id & '' order by dateuploaded desc'
    end if
    Set rs = db.Execute( SQL )
    if not rs.EOF then
    if isnull(rs('thumbblob')) then
    SQL = 'SELECT image_blob as thumbblob, filename, filesize FROM IMAGES where id=1'
    rs.close
    Set rs = db.Execute( SQL )
    end if
    else
    if isnull(rs('thumbblob')) then
    SQL = 'SELECT image_blob as thumbblob, filename, filesize FROM IMAGES where id=1'
    rs.close
    Set rs = db.Execute( SQL )
    end if
    end if
    if not rs.EOF then
    Response.ContentType = 'application/octet-stream'
    ' let the browser know the file name
    Response.AddHeader 'Content-Disposition', 'attachment;filename=' & Trim(rs('filename'))
    ' let the browser know the file size
    Response.AddHeader 'Content-Length', rs('filesize')
    Response.BinaryWrite rs('thumbblob')
    rs.close
    end if
    db.Close
    set rs=nothing
    set db=nothing
    response.flush
    response.end
    %>
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. You're going to need a ASP Developer to get things working properly.
    I was able to see most of what's going on by uploading lightning_mcqueen04.jpg
    Thereappears to bea lot of configuration and scriptproblems.
    Once the image was loaded thesource for the image was:
    <IMG SRC='showimage.asp' width=200 height=83 ALIGN='center' BORDER='0'>
    In a table header.

    You can call another page from Classic ASP but it's not going to work like that.
    Getting things in order will definitely be outside the context of these forums.
    Salute,
    Mark
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page