|
Hi everyone,
This is an issue I have been picking away at for the last week now and am out of ideas. Right now I am working on an ASP page that allows a user to submit an ID and select from a list of images that are stored in a SQL Server database. I am able to search for the images, display the results, and get the Internet Explorer download screen. Unfortunately, I am having trouble getting the image to be the file that is downloaded. The link in the results calls a getAttachment.ASP file which triggers the download. Below are the details.
Image Column: ATTACHMENT
Image filename:QM1BM.TIF
Image ID:att_id
-------------------Code---------------------
<% Function GetImageData(ID)
Dim SQL,rs,strConnection
strConnection = "DSN=DPA_Database;uid=my_username;pwd=my_password;DATABASE=My_Database;APP=ASP script;NETWORK=DBMSSOCN;TABLE=my_images"
Set db = Server.CreateObject("ADODB.Connection")
db.Open strConnection
SQL = "SELECT ATTACHMENT FROM dbo.DPA_IMAGES where att_id =" & ID
Set rs = db.Execute( SQL )
GetImageData = rs("ATTACHMENT")
End Function
'If rs.EOF Then Response.End '
Response.ContentType = "application/octet-stream"
' Let the browser know the file name '
Response.AddHeader "Content-Disposition", "attachment;filename=My_image_file_name"
' Let the browser know the file size '
Response.AddHeader "Content-Length", "500000"
'send image To the client from ASP'
Dim ID
ID = 3751
If IsNumeric(ID) Then
Response.BinaryWrite GetImageData(ID)
End If
%>
-----------------------------------
Your help is greatly appreciated.
Thanks,
Leo
|
|
|
|
|
|
|
|