[Zope] how can I force download of a word document as a file and not have it calling word?

Barry Pederson barryp@medicine.nodak.edu
Tue, 16 Apr 2002 09:38:21 -0500


Oliver Bleutgen wrote:
> Phil Harris wrote:
>  > That makes no difference as far as I can see, as soon as Windows sees 
> the
>  > .doc extensions it will fire up Word to receive the file.
>  >
>  > Windows sets more store in the file extension than the mime type.
>  >
> + it analyzes the content to some extent (hardcoded).
> 
> Robert, search for the "content-disposition" header on google, it's 
> possible to do this, I just don't remember exactly offhand.

I know that in Apache, the directives:

----
     ForceType application/octet-stream
     Header set Content-Disposition attachment
----

does the trick (I have tried this specifically with IE and .doc files).  I 
would assume the Zope equivalent would be something like:

----
<dtml-call 
"REQUEST['RESPONSE'].setHeader('content-type','application/octet-stream')">
<dtml-call "REQUEST['RESPONSE'].setHeader('content-disposition','attachment')">
----

    Barry