Scott,
If the URL to your servlet is:
http://<server>/DLServlet
Then append the name you would like the browsers to use in the file dialog:
http://<server>/DLServlet/special.zip
This will fool the browsers into presenting 'special.zip' in the 'save
as...' dialog. You can search the archive
(http://archives.java.sun.com/archives/servlet-interest.html) for previous
messages I posted explaining it in more detail.
HTH,
Chris
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Scott
> Neufeld
> Sent: Tuesday, March 23, 1999 1:10 PM
> To: [EMAIL PROTECTED]
> Subject: Naming files in Download servlet
>
>
> I'm trying to name a file that is being downloaded via a servlet.
> I have done
> this:
>
> response.setContentType(mimeType); // i.e. "application/x-zip-compressed"
> response.setHeader("Content-dispostion", "attachment;
> filename=\"" + itemName +
> "\"");
> response.setContentLength(getItem().length) ;
> .. then I print it
>
> The file downloads fine, works and everything, but the filename
> is incorrect (it
> is still the name of the servlet, although it does append the
> suffix of the
> filename, i.e. "ServletName.zip").
>
> Any ideas?
>
>
>
> Roger Niederland wrote:
>
> > Try this:
> > ------------
> > res.setContentType("application/octet-stream") ;
> > res.setHeader("Content-dispostion", "attachment;filename=" +
> myfilename ) ;
> > res.setContentLength(length) ;
> >
> > <read file and output the stream of data for browser>
> > -------------
> >
> > -----Original Message-----
> > From: Knut Martin Tornes <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > Date: Friday, January 01, 1999 12:29 PM
> > Subject: Naming files in Download servlet
> >
> > >Hi folks!
> > >
> > >I currently have a servlet used to download files from an internal
> > >network disk (outside the web server's path). To do this, the servlet
> > >opens the file and streams the file as binary data. My problem is to
> > >give the stream a name other than the servlet's name. I've tried to set
> > >various HTTP header info but without any luck so far.
> > >
> > >To clarify a little bit: the URL
> > >http://my.domain.com:8080/servlet/Download?some_parameter=some_value
> > >make Internet Explorer and Netscape (and probably other browsers as
> > >well) suggest 'Download.' as the name of the file to download.
> > >
> > >Any suggestions?
> > >
> > >thanx in advance,
> > >Knut Martin Tornes,
> > >objectBOX
> > >Norway
> > >
> >
> >=================================================================
> ==========
> > >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
>
> __________________________________________________________________
> _________
> 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