March 17th, 2003, 03: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, 07: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 04:06 PM.
March 18th, 2003, 01: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, 04: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 09:55 AM.