Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to download file in IE

Status
Not open for further replies.

mingus

Programmer
May 8, 2001
59
US
I am trying to write code that will download text for the user. I do this by changing the content-type to anything and then setting the filename to use. In Netscape this works perfect, in Internet Explorer this doesn't work at all.

I get the message: "Internet exploer cannot download from the internet site".

Here is the code I have in pageReqestBegin (I also tried in a Servlet with the same result).

Any help would be much appreciated!

OutputStream out;
String fileName;
String content = "Hello\n";
byte[] data;

PrintWriter printWriter = res.getWriter();
res.setContentType("application/junk");
res.setContentLength(content.length());
fileName = "test.txt";
res.setHeader("Content-Disposition", "inline; filename=\""
+ fileName + "\"");

printWriter.write(content);
printWriter.flush();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top