aspose file tools*
The moose likes Servlets and the fly likes force download of a binary file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "force download of a binary file" Watch "force download of a binary file" New topic
Author

force download of a binary file

Charles Cayman
Greenhorn

Joined: Jul 02, 2002
Posts: 8
Hi,
I would like to force IE to download a binary file, like a .pdf, or .doc file.
What I do is I call:
res.setContentType("application/octet-stream");
However, IE still displays the contents of the file. What I want is to force the display of a "Save As" dialog box.
How can I go about doing this? Thank you.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You can use this as well:

/Rene


Regards, Rene Larsen
Dropbox Invite
Charles Cayman
Greenhorn

Joined: Jul 02, 2002
Posts: 8
Hi Rene,
Thanks for the tip, it works!
However, I couldn't find this technique anywhere else. I mean, I have two books (O'reilly and Sun), but they both don't have anything about this Content-disposition header.
What I want to find out is where or how can I know about things like this when get stuck again in the future?
Thanks again in advance.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: force download of a binary file