Hai,
The following code will solve ur problem.
resp.setContentType("application/octet-stream");
resp.setHeader("Content-disposition", "attachment: filename=test.jpg");
The above code will invoke the browsers default save dialog with the
default file name test.jpg to be stored.
Regards,
Lakshminarayana M
On Thu, 21 Oct 1999, Alvaro Fuentes wrote:
> I have a servlet which downloads an image file to client machine. If I
> set
>
> res.setContentType("image/jpeg");
>
> , clients will show the image. Instead of this, what I want to do is
> open browser's file dialog to allow clients to save the image, so I must
> include
> res.setContentType(someStrangeContentTypeNotRecognizedByClientBrowser);
>
> Is there any way to avoid this without changing web server
> configuration?
>
> Moreover, the name of the file which appears in browser's file dialog is
> the name of the servlet, not the name of the image. Is there any way of
> changing this?
>
> Thanks in advance
>
> ___________________________________________________________________________
> 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
>
___________________________________________________________________________
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