Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Setting path for "Content-disposition" filename

679826Jan 22 2009 — edited Jan 22 2009
I'm trying to figure out how to set the filename in the following:
String path = "/usr/local/jakarta-tomcat-4.1.29/webapps/myapp/my_images.zip";
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition","attachment; filename=" +path);
The file that I'd like the user to download is called my_images.zip. It resides here: /usr/local/jakarta-tomcat-4.1.29/webapps/myapp/my_images.zip
However, when I run the servlet, it pops up a dialog box with this as the filename: usrlocal_jakarta-tomcat-4.1.29_webapps_myapp_my_images.zip
It's replaced the slashes with underscores. What's going on? The zip file resides in the root folder of my app. The servlet is in a subfolder called "fpauto".
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2009
Added on Jan 22 2009
13 comments
5,186 views