472,352 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

Unable to download BLOB IMAGE using ODBC

Hi everyone,

This is an issue I have been picking away at for the past two weeks and am running short of ideas. :-\ I am writing an ASP page that allows a user to open/save a tif image stored on SQL Server.

The user triggers the download by clicking a hyperlink which loads getAttachment.asp (code listed below). GetAttachment.asp connects to SQL Server through an ODBC and attempts to download the specified tiff using BinaryWrite(). It looks like the file being downloaded is very close in size to the image but, not a tiff.

Are there any procedures I may be missing when attempting to retrieve the image?
Is a byte array necessary when trying to pass an image type from a table to the web browser?

Any suggestions would be greatly appreciated.


images.table
Image ID(int): att_id
Image Blob(image): ATTACHMENT

Image filename:QM1BM.TIF
---------------------------------------------------------------------------------------

<%
dim objConn, objRS, strSQL, strConnection
dim PubID
PubID = 3751

Response.Clear
Response.Expires = -1
Response.ContentType ="image/tiff"

set objConn=server.CreateObject ("ADODB.connection")
objConn.ConnectionString="DSN=DPA_Database;uid=use r_id;pwd=pwd;DATABASE=DPA_Database;APP=ASP script;NETWORK=DBMSSOCN;TABLE=dbo.DPA_IMAGES"
source=DOUG
objConn.Open

set objRS=server.CreateObject ("ADODB.Recordset")
strSQL= "SELECT * FROM dbo.DPA_IMAGES WHERE att_id='"& PubID &"'"
set objRS=objConn.Execute(strSQL)

'Let the browser know the file name'
Response.AddHeader "Content-Disposition", "attachment;filename='"& (objRS("R1_ID")) &"'.tiff"
'Let the browser know the file size'
'Response.AddHeader "Content-Length", "500000"'
Response.BinaryWrite (objRS("ATTACHMENT"))
Response.End

objRS.Close
objConn.Close
set objConn = nothing
set objRS = nothing
%>
Jan 24 '07 #1
0 1548

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). ...
11
by: CSN | last post by:
Is it possible to iterate over an array in plpgsql? Something like: function insert_stuff (rel_ids int) .... foreach rel_ids as id insert...
10
by: Peter Stojkovic | last post by:
I want store an integer-array of 1000 Values in a blob in a SQL-database. I will do this every 10 Seconds. How can I do this ???? What...
0
by: LuisH | last post by:
Hi, I'm very new on this group. I don't know if this is a old point here. My question is: What is the best way to access Blob rows using...
3
by: Chris | last post by:
Hi all, I am trying to use System.Data.ODBC to insert a file into a binary field in SQL Server 2000. Now, before you yell at me, the reason I...
2
by: Chenna Sudarsan | last post by:
Hello, I am connecting to Oracle9.2 database from VB6.0 using MSDAORA provider. I am using ADO2.5. When I try to access a blob column of oracle I...
4
by: satish mullapudi | last post by:
Hi Gurus, I am using DB2 UDB 8.2.I want to load/insert images into DB2 database.So I found out we need to enable DB2 Image extender .How to...
0
by: bfiser | last post by:
This is the error I get when I try to open my asp page. When I try to open the HTML page that uses the ASP page as a source for my image I get a...
8
by: Godzilla | last post by:
Dear all, I cannot find a solution for my problem with inserting a blob object (>4000 in length) into an ORACLE database via ODBC. I have...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.