This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Downloading and saving/opening  a file 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 » Servlets
Bookmark "Downloading and saving/opening  a file " Watch "Downloading and saving/opening  a file " New topic
Author

Downloading and saving/opening a file

aman hindustani
Ranch Hand

Joined: Jun 15, 2006
Posts: 57
Hello to all...

i have written a code for just viewing a binary format file stored in a database when view button is clicked. It is working properly..giving the desired result..when server is running.

Later i wanted to modify the code..to ..not only to view the image or file..etc. but give an option to save the file to the local system.But it is not happening...But, to my amazing..after stopping the server(tomcat)...

Opened the source code file in edit plus..then pressed ctrl+B(to see in browser view) then it is giving a option to save or open the file.After saying it to save it is saving the source file..how it is happened i dont know..but i want to know how and why it happend...by knowing the reason ..i can use the same concept..for saving the file..

Here i am placing the code..please help me out..please.




Thanks to all..
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

In the Content-Disposition header, you can suggest that the browser either show the content 'inline' or have it sent as an 'attachment'.
The latter will cause the save/open dialog to be opened up with most browsers.



Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
aman hindustani
Ranch Hand

Joined: Jun 15, 2006
Posts: 57
Thanks Ben...for your reply..


ben..you mean to say..Attachment..in the set header( )...will allow me to give option to open/download...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Downloading and saving/opening a file
 
Similar Threads
insert view, images from mysql database using jsp program
how to see the multiple images from database
shoping cart
retrieve images from a database
Retrive image from MySQL database in fix format on JSP page