You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Zsolt Koppany <zk...@web.de> on 2001/08/30 18:29:25 UTC

IE and downloading a binary file

Hi,

My servlet has to get the Browsers to download binary file independently of their contents. For this purpose I use response.setContentType("application/octet-stream") and I write the content of the file into the output stream of the server. it works fine with Netscape and partly with IE. The problem is that IE obviously ignores setContentType() and depending of the file sometime it tries to show the content of the file instead of downloading it.
How can I force IE to download the file?
Zsolt
-- 
Zsolt Koppany
Intland GmbH www.intland.com
Schulze-Delitzsch-Str. 16
70565 Stuttgart
_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de



Re: IE and downloading a binary file

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
> Hi,
> 
> My servlet has to get the Browsers to download binary file independently of their contents. For this purpose I use response.setContentType("application/octet-stream") and I write the content of the file into the output stream of the server. it works fine with Netscape and partly with IE. The problem is that IE obviously ignores setContentType() and depending of the file sometime it tries to show the content of the file instead of downloading it.
> How can I force IE to download the file?

You can't. If IE wishes to ignore regular headers, there is nothing to be done. Unless someone can suggest an ActiveX control which will force download :-)

Nix.

Re: IE and downloading a binary file

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
I believe from previous posts that IE cheats on the content type of 
downloaded files by looking at the filename as opposed to the content type 
spec.  To get around it, you have to use the three letter file extension in 
the filename that corresponds to your file type (example: .jpg for jpeg 
files, .doc for Word docs, .exe for executable files)

--David Smith 

And not just the name. Sometimes IE peeks into the file itself, trying to guess what it is. I believe it happens for unregistered file extensions.

Nix.

Re: IE and downloading a binary file

Posted by David Smith <dn...@cornell.edu>.
I believe from previous posts that IE cheats on the content type of 
downloaded files by looking at the filename as opposed to the content type 
spec.  To get around it, you have to use the three letter file extension in 
the filename that corresponds to your file type (example: .jpg for jpeg 
files, .doc for Word docs, .exe for executable files)

--David Smith 

On Thursday 30 August 2001 01:06 pm, you wrote:
> Friend, if you ever find out, please let me know--I've been searching
> for a solution to this IE "feature" for over four years now!!
>
> I've fallen back on telling the user in my documentation to use the
> browser's save function (in the case of text, images, etc.) or the save
> of the application opened in the browser window (in the case of Excel,
> Word, etc.).
>
> Jez, I wish Mozilla would finally get it together...
>
> Zsolt Koppany wrote:
> >Hi,
> >
> >My servlet has to get the Browsers to download binary file independently
> > of their contents. For this purpose I use
> > response.setContentType("application/octet-stream") and I write the
> > content of the file into the output stream of the server. it works fine
> > with Netscape and partly with IE. The problem is that IE obviously
> > ignores setContentType() and depending of the file sometime it tries to
> > show the content of the file instead of downloading it. How can I force
> > IE to download the file?
> >Zsolt


Re: IE and downloading a binary file

Posted by Jason Eacott <ea...@hardlight.com.au>.
hi all,
	if you just make up a mime type of your own that the browser 
does not understand then you will be presented with a saveas 
dialog in IE.

what I want to know is if you have a mime type that is correct (ie 
for a flash animation etc) why IE5+ insists on refusing to display it 
but asks you what app you want to open it in. IE4 just works as 
expected.
any thoughts?
have microsoft invented some new addition to the http protocol?



-- 
Jason Eacott
Hardlight Interactive
http://www.hardlight.com.au

Support bacteria - they're the only culture some people have.

Re: IE and downloading a binary file

Posted by Thad Humphries <th...@mindwrap.com>.
Friend, if you ever find out, please let me know--I've been searching 
for a solution to this IE "feature" for over four years now!!

I've fallen back on telling the user in my documentation to use the 
browser's save function (in the case of text, images, etc.) or the save 
of the application opened in the browser window (in the case of Excel, 
Word, etc.).

Jez, I wish Mozilla would finally get it together...

Zsolt Koppany wrote:

>Hi,
>
>My servlet has to get the Browsers to download binary file independently of their contents. For this purpose I use response.setContentType("application/octet-stream") and I write the content of the file into the output stream of the server. it works fine with Netscape and partly with IE. The problem is that IE obviously ignores setContentType() and depending of the file sometime it tries to show the content of the file instead of downloading it.
>How can I force IE to download the file?
>Zsolt
>

-- 
-------------------------------------------------------------------------
Thad Humphries               "...no religious test shall ever be required
Web Development Manager       as a qualification to any office or public
Phone: 540/675-3015, x225     trust under the United States." -Article VI