download image files

Philip Greenspun's Homepage : Philip Greenspun's Homepage Discussion Forums : 6916 : One Thread
Notify me of new responses
Once we've uploaded an image file into our oracle db, how do we download the image back to the browser for viewing? If in an img tag, then what is the path to the image?

-- David Sirkin, October 11, 1999


If we should use ns_ora blob_get_file then perhaps I'm using it incorrectly. In this case, the ns_ora call is embedded in an ns_db getrow loop following an ns_db select to query for the id, caption, size, etc.
ns_ora blob_get_file $db "
    select photo from family_photos
    where family_photo_id = $family_photo_id" /tmp/$client_file_name
The file exists in /tmp/$client_file_name, but my html page can't seem to find it.

-- David Sirkin, October 11, 1999

Use ns_ora write_blob to send the image to the connection... (you'll need a separate page that just sends the image data to the client)

-- Ben Walter, October 11, 1999

Make sure you output the correct mime-type. If you are using more than one kind of image, you may want a column which indicates what kind of image it is.

-- Andy Quigley, January 12, 2000

-- listle Liu, April 23, 2005