I don't remember what the Sun downloads URL look like, but try the
following.
The easiest way to do it is to call the servlet with an extra bit of
pathInfo. Netscape will use the text after the last slash ("/") to
determine the filename to save as.
http://www.somewhere.com/servlet/myDownloader
Netscape will default the filename to myDownloader
http://www.somewhere.com/servlet/myDownloader/larry.jpg
Netscape will default the filename to larry.jpg
Lance Lavandowska
www.AgDomain.com
www.Brainopolis.com
----- Original Message -----
From: "Larry Tate" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 14, 1999 9:59 AM
Subject: how to download file with filename specified
> servet experts,
>
> I'm trying to download a file from my server using servlets.
> However, when it prompts for the local filename (netscape browser)
> it gives the default name of the file as the name of the servlet. This
> is undesireable. I would like to specify the name.
>
> I see the sun downloads do this all the time.
>
> I currently do this:
>
> res.setContentType("application/x-zip-compressed");
> res.setContentLength(<filesize>);
> OutputStream out= res.getOutputStream()
>
> <Then use the OutputStream to write the file>
>
> It works, the file is downloaded correctly. However, the
> prompt in netscape is not good.
>
> Is there a header to try?
>
> Thanks,
>
> larry
> --
> Larry Tate [EMAIL PROTECTED] (757)726-6662
> Bldg 135, Ft. Monroe, VA, 23651
>
>
___________________________________________________________________________
> 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