Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes Display BLOB contents to the client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display BLOB contents to the client" Watch "Display BLOB contents to the client" New topic
Author

Display BLOB contents to the client

Ramesh Bhagasra
Greenhorn

Joined: Nov 21, 2003
Posts: 8
I want to display the blob contents in the clients window and give him the option either to open or save the contents. I am able to read the contents from Oracle Blob Field and stored the contents in the ByteArrayOutputStream object but I am not able to open the contents for the client. I am using the following code
Blob blob = resultSet.getBlob(1);
int length = (int)blob.length();
byte [] b = blob.getBytes(1, length );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(b,0,length);
response.setHeader("Content-Disposition","attachment; filename="+baos );
Please help me
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
This sort of thing comes up all the time - browse the last few weeks of post or do a search for BLOB.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display BLOB contents to the client
 
Similar Threads
Intercepting XML using Servlet Filter
Reading From a Binary Large Object(BLOB)
send contents as attachment
how to upload xls file
Can't read the image from the database after insertion.