Originally posted by Alex Vasconcelos:
Has anyone been able to successfully write servlet code to download files to a client machine that works with both Netscape and IE ?
Currently I have code that generates a file to be downloaded and streams that file back to the client. This works perfectly with Netscape:
response.setContentType("application/zip; name=\"" + fileName + "\";");
response.setHeader("Content-Disposition" , "attachment;filename=" + fileName);
With IE I get an error trying to display the page. To make it work with IE all I have to do is remove the line where I set the Content-Disposition header, but this makes IE try to save the file as the name of the servlet. In other words, if the link is http://www.foo.com/aServlet, IE will try to save a file called "aServlet", which is not what I want.
According to RFC's the Content-Disposition hearder is supposed to take care of that, but there seems to be several problems with the way IE handles that.
I am currently using IE 5.5 SP 2. Have also tried this with IE 6.0 and it didn't work.
Any help will be greatly appreciated.
Thanks in advance,