aspose file tools*
The moose likes Servlets and the fly likes Content-Disposition: Download file name problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Content-Disposition: Download file name problem" Watch "Content-Disposition: Download file name problem" New topic
Author

Content-Disposition: Download file name problem

Shanu Paul
Greenhorn

Joined: Aug 19, 2006
Posts: 2
Hi,

In my servlet I am trying to let the user download a file using the following code:

response.setContentType("application/msword");
response.setHeader("Content-Disposition","attachment; filename=wordfile.doc");

This works fine in Netscape, but when trying to do this in IE (including IE 6.0) the filename is the name of the servlet and not the file name specified. Is there anyway to fix this? If IE cannot handle the Content-Disposition correctly, is there any other way other than using Content-Disposition to handle it.

Please let me know. Many thanks.

Regards,
Shanu
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you try with double quotations around the filename ?


[My Blog]
All roads lead to JavaRanch
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

Might want to review: http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html

They have some tips for how to help with IE.


My Blog: Down Home Country Coding with Scott Selikoff
 
Consider Paul's rocket mass heater.
 
subject: Content-Disposition: Download file name problem