This is something that is *supposed* to be possible by setting MIME
types for the file, but you'll run into some problems.
If you have a servlet that downloads the file, you can "fool" the
browser into using the right file extension by appending your
servlet with extra 'path info'
http://yourdomain.com/yourServletName/fakename.jpg
the servlet will receive 'fakename.jpg' as one of the request parameters
named 'PATH_INFO' - but the browser will think it is downloading
a file with the name 'fakename.jpg' and therefore try to use this
as the downloaded filename and save your users the trouble of having
to rename the file after download.
If you were to set a mime type to one the browser doesn't understand
what to natively do with (like octet/stream) it is supposed to then
prompt the user to save the file ... BUT (there has to be a but, doesn't
there) Microsoft decided to make IE "smart" enough to disregard the
mime type setting if it felt it had a better idea what to do with a
particular file - so IE will see the 'jpg' extension and, even though
the mime type is for plain binary data, will treat it just like
a standard jpeg served with the proper jpeg mime type.
--
Long story short, you may wish to re-think your user experience to
work more in line with the way current browsers treat the filetypes you
wish to deal with.
- vin
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Rebecca Coleman
> Sent: Wednesday, April 19, 2000 3:19 PM
> To: [EMAIL PROTECTED]
> Subject: downloading images
>
>
> hey all -
>
> here is the user experience i am trying to create:
>
> user sees:
>
> image and a "download" button
>
> user clicks button
>
> user sees the "open this file from current location/save this
> file to disk"
> dialog box for the (here's the catch) jpg file (the image they
> are seeing).
>
> does anyone know if there is a way with java/jsp/java
> beans/servlets to make
> this happen? has anyone ever done this?
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets