March 17th, 2003, 02:58 PM
Save To Dialog BOX
In a JSP I have the link to a File on my HD. What should I do so when i click on the link, it opens me a dialog box and asks me where to save it instead of opening the file in the page?
March 17th, 2003, 06:48 PM
This is actually a basic html question. What kind of file is it?
EDIT: I take this back. It is a basic http question and thought not technically a java problem, it was appropriate for this forum imo.
Last edited by Nemi; March 18th, 2003 at 03:06 PM.
March 18th, 2003, 12:57 PM
any kind.... doc, zip, etc.
it will only open the dialog with a .zip file. otherwise, it will open the file
March 18th, 2003, 03:01 PM
You need to set the Content-disposition header.
The filename-parm tells the browser to put that name in the save dialog by default. The size-parm tells the browser how big the file is going to be. I believe this will give you that "time left" dialog in windows when downloading a large file. Without the size-parm it wil just give you a generic download speed dialog when downloading.
response.setHeader("Content-Disposition", "attachment; filename=useThisName.doc; size=1234");
Last edited by Nemi; March 20th, 2003 at 08:55 AM.