This probably doesn't matter, but try this instead:

response.setHeader("Content-Disposition",
  "attachment;filename=\"" + myFileName + "\"");
// Removed the space in between "attachment;" and "filename"
response.setContentType("application/octet-stream");
// I don't think you need to specify the filename again

Using the above seems to work for me, but I'm not sure if a user with
IE5 has tried it.  What happens when you use it in IE5?  Error message?
Data output to the screen?  Empty file?

It might be a MIME problem also.

-Brian

-----Original Message-----
From: Rai Ou [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 13, 2004 9:45 PM
To: 'Tomcat Users List'
Subject: HELP: Servlet File Download solution.


I wrote a download servlet but I found it didn't run at IE5.x

IE6.x - OK
IE5.x - NG
NS - OK

My source is below. I want to know if there are better solutions or any
Common Libarary I can use.

response.setHeader("Content-Disposition",
  "attachment; filename=\"" + myFileName + "\"");
response.setContentType("application/octet-stream;
  name=\"" + myFileName + "\"");
String f = myFilePath;
PrintWriter out = response.getWriter();
BufferedReader in 
    = new BufferedReader(new FileReader(f));
String line;
while ((line = in.readLine()) != null) {
   out.println(line);
}
in.close();

Thanks.
Rai



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to