|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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?
|
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
any kind.... doc, zip, etc.
it will only open the dialog with a .zip file. otherwise, it will open the file |
|
#4
|
|||
|
|||
|
You need to set the Content-disposition header.
Code:
response.setHeader("Content-Disposition", "attachment");
optional:
response.setHeader("Content-Disposition", "attachment; filename=useThisName.doc; size=1234");
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. specs here: http://www.ietf.org/rfc/rfc2183.txt Last edited by Nemi : March 20th, 2003 at 08:55 AM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Save To Dialog BOX |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|