Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with Response.BinaryWrite

    I am have ASP code that will upload and store a jpg. image in a database in binary form.
    this works fine. Displaying out one image at a time on display.asp using Response.BinaryWrite works fine, but when I try to use the image src to display the image (inside a loop), and pass the productID back to the page the write the image, I get no images!

    .....here is the code for file.asp which wite out one file at a time and display.asp which displays in on a page

    <%
    '--------------------------------------------------------------------------------------------------------------------------
    '.....here is the contents of File.asp

    productID = Request.QueryString("productID")

    connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
    Server.MapPath("data\allseasons.mdb")
    Set rsX = Server.CreateObject("ADODB.Recordset")
    rsX.Open "select [File Data],[Content Type] from products where productID = " & _
    productID, connStr, 2, 4

    If Not rsX.EOF Then
    Response.ContentType = rsX("Content Type")
    Response.BinaryWrite rsX("File Data")
    End If
    '--------------------------------------------------------------------------------------------------------------------------
    %>


    ....here is the contents of display.asp (display the image out.)
    <!------------------------------------------------------------------------------------------------------------------------->
    <img border="0" src="file.asp?productID=<%=RS("productID")%> width="100" height="100">
    <!------------------------------------------------------------------------------------------------------------------------->


    The line above is written into a loop

    The line above does not seem to pass the product ID to file.asp, or the line below
    productID = Request.QueryString("productID")

    I can hard code a product number into file.asp like productID=2099 and then display.asp will show the correct image, but it shows this same image for all products when I loop through all the records.
    I want it to show the correct image for each record.

    Bottom Line:
    Can't hard code productID in file.asp, and when i try to read it in dynamically from: <img border="0" src="file.asp?productID=<%=RS("productID")%> width="100" height="100"> I get no images!

    Can this be done? It's driving me nuts and It's holding up a good paying Website!

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lisbon, CT
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure this is the problem but might be:

    change this:
    Code:
    <img border="0" src="file.asp?productID=<%=RS("productID")%> width="100" height="100">
    to this:
    Code:
    <img border="0" src="file.asp?productID=<%=RS("productID")%>" width="100" height="100">
    BaldEagle


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •