The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000

Advertisement

Advertisement

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.

Message:

IE 5.5 Download bug

Posted by Barry on March 09, 2001 at 6:04 PM

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:
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=somefile.req");

Thanks
Barry

> Hello there,
> i am facing some wired problem similar tio this.
> I;ve used res.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\";")

> And i am using IE5.5 , When download dialog pops up, and choose
> to save as, i do not get filename which was specified. Rather get
> current webpage file name, but choosing to open twice and third
> click to save as it gets right filename

> my question is, is there anything wrong with browser or
> i am not writting routine properly if so can you pls. just
> list the steps? Do i have to close the stream when write is
> complete?

> Pls. reply asp.

> Thanks
> -Raj


> > Hi krnbhaskar,

> > 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.





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us