RE: How to force a file download to save
Jean-Christophe CHARVY <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
Hi,
If you manage download through servlets, you can specify which behaviour the client browser has to follow.
To force the file download to save, use :
response.addHeader("Content-Disposition", "attachment; filename=" + filename);
JC
http://jc.charvy.free.fr/
---------- Entête Initiale -----------
De : "A mailing list for discussion about Sun Microsystem's Java Servlet API Technology." <[email protected]>
A : [email protected]
Copie :
Date : Wed, 21 May 2003 10:47:47 -0400
Objet : How to force a file download to save
> Group,
> can someone tell me what the options are for forcing a file
> download to pop up a save dialogue.
>
> What I want to do is force the save dialogue to open for any of the
> files available from a particular site for download, including our xml,
> txt and csv files.
>
> As far as I know, I can either:
> 1. Change my server mimetypes so that it defaults to sending my file
> with a content type of e.g. "bad/type"
> 2. Manually alter the response object to set the content type to e.g.
> "bad/type".
>
> Are there any other ways that I can do this?
> Cheers,
> Neil.
>
> ___________________________________________________________________________
> To unsubscribe, send email to [email protected] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
------------------------------------------
Faites un voeu et puis Voila ! www.voila.fr
___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html