Sponsored Link •
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
> I am experiencing the same bug in IE 5.5 SP1 with Downloading from a Servlet.
> However this works for me on Windows 2000 but not on Windows NT 4.0 (SP5).
> Can Someone help or let me know if you have found an answer to this problem?
> I have also had problems with the download adding extensions like somefile.req.req (in Netscape 4x versions) and somefile.req.xml (in IE 5.5 on Windows2000). The file is really an XML file but I set the content type to application/octet-stream to always prompt the save as. Has anyone seen similar issues or know of a way to fix this.
> Sample Download Servlet Java code:
> > Hello there,
> > And i am using IE5.5 , When download dialog pops up, and choose
> > my question is, is there anything wrong with browser or
> > Pls. reply asp.
> > Thanks
> > > I just changed the line from
res.setHeader("Content-Disposition","attachment; filename=\"" + downloadFile + "\";");
> > > to
res.setHeader("Content-Disposition","attachment; filename=\"" + "abc.txt" + "\";");
> > >
Then I ran the servlet using Netscape and IE both and both gave me the correct file name (abc) and correct file type (plain text - Netscape, text document - IE) to save. So my guess is that your program is correct.
> > >
I don't know why it showed you different names, but I'm speculating that perhaps it is because of differnt file extensions getting recognized differently by the browsers. Perhaps you may want to try to hardcode the name the way I did to test out whether Netscape and IE are still behaving differently when extension is .txt or whether they behave differently when some other extension comes into picture.