Hi all,
Some time back there was a question posted on the forum as to how to set file names
for HTML Downloads.Below is one response of the question.
Now i need to how i can set a blank value to the filename in the save dialog box
that appears.I donot want any file name to be specified in the dialog but let user
enter it.How do it i do that.?
I tried doing it by the following CODE
string spacesvariable="";
response.setHeader("Content-Disposition","inline;filename="+spacesvariable);
This behaves differently in Netscape4.7 and IE 5.0
In netscape it automatically adds ".html" in the dialog box
while in IE 5.0 it does not do so
i want it absolutely a blank entry there.
How do we go about it?
Anticipating early replies
Aravind Kumar L.N.S
Thor Heinrichs-Wolpert wrote:
> Yes you can, try this:
>
> response.setHeader("Content-Disposition","inline;filename="+theFileName);
>
> Thor HW
> ----- Original Message -----
> From: "Hendrik Schreiber" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 16, 2000 1:59 AM
> Subject: Re: setting the file name for HTML downloads
>
> > Hi!
> >
> > You cannot set the filename in a header, but there is a trick you can try:
> >
> > * map your servlet to /fileservlet/* (according to servlet spec 2.2)
> > * put a link in your page pointing to /fileservlet/foo.doc
> > * in the fileservlet call request.getPathInfo() to get the filename
> ("foo.doc")
> > * map the filename to the real filename and
> > * send back the real file (e.g via requestDispatcher.forward(), if the
> file has
> > the correct extension or via include() if it does not. If it does not
> you have
> > to set the content type manually with
> > response.setContentType(getServletContext().getMimeType(String
> filename)))
> > * as the link pointed to /fileservlet/foo.doc, the browser will take
> foo.doc as
> > filename.
> >
> > good luck,
> >
> > -hendrik
> >
> > David Wall wrote:
> >
> > > I have a file that I'd like to return from my web server, but the name
> of
> > > the file on the web server is not the same name I'd like it to
> "download" as
> > > (like the default name that appears in the Save As when the file
> download
> > > dialog displays).
> > >
> > > For example, the real file name may be something like
> > > /usr/local/apache/uploaded/u100 which was originally called something
> like
> > > foo.doc when it was uploaded. The file was renamed in order to allow
> > > multiple foo.doc files to be uploaded by many people without there being
> any
> > > conflict in file names (or even multiple uploads from the same person,
> but
> > > each one is unique).
> > >
> > > I have a Java servlet that can set the content-type and then writes the
> u100
> > > file to the output stream, but the file is called "u100" by default.
> I'd
> > > like the user to see by default the original name (foo.doc). I have
> this
> > > info in my database, but I'm not sure how to set the "file name" of the
> > > downloaded file. Is there something in the HTTP headers or the like
> that I
> > > can set like the content-type attribute is used to say whether it's
> > > text/html, text/plain, application/msword, etc.?
> > >
> > > Thanks,
> > > David
> > >
> > >
> ===========================================================================
> > > 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
> >
> > --
> > - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > tagtraum industries http://www.tagtraum.com/
> > jo! small&smart 2.2 servletengine
> > Java Server & Servlets The web-application book
> > The WebApp Framework http://www.webapp.de/
> >
> >
> ===========================================================================
> > 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
> >
>
> ===========================================================================
> 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
--
################################################################
Aravind Kumar L.N.S
Systems Engineer,
Wipro Technologies,
Corporate Domain, Account : Deploy,
Survey No. 64, SerilingamPalli Mandal
Madhapur, Hyderabad - 500033,
Phone : +91 40 6565211 (O)
Fax : +91 40 3110043 (O)
Email : [EMAIL PROTECTED]
www.wipro.com
The World's First SEI CMM Level 5 Software Services Company
################################################################
===========================================================================
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