Hi All, I will have a jsp page that knows the path and name to a PDF file on the server machine. I want to provide a "download" button so that a user can get the file onto thier client machine. They won't want to open/look at the file, just save it to thier client machine. The part that I am confused by right now is, how can I let them navigate the windows folder system so they can specify what folder to save the file to and what to name the file? Thank you for any pointers, Kim
The Content-Disposition header allows you to mark a response as either "inline" or "attachment".
The "attachment" value suggests that the browser open the "What do you want to do with this?" dialog. If the machine has the proper application installed (Adobe Acrobat for instance), the user can choose to either open it or save it.
There is an example of this tag in the JSP FAQ. Look for JspAndExcel.
Hmm, I guess I am not sending the file to the browser, doh!
I was hoping I could just prompt the user to tell me what they want to name the file, and where they wanted to put it, and then on the java side I could save the file to that location, not have to send it to the jsp. One the java side I will have a handle on the file location and name on the server machine.
Not sure if this is doable though. Sorry, I am new to this stuff, very much appreciating your help.
You cannot prompt the user for a file location. What will happen is that, if the content disposition is correctly set, the browser itself will open a File Save dialog when the file is sent to the browser. The user can then pick where the file is to be saved. You do not get to participate in this process. [ June 29, 2007: Message edited by: Bear Bibeault ]