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

Thomas B. Passin tpassin@mitretek.org
Tue, 16 Apr 2002 11:21:28 -0400


[Barry Pederson]


> 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')">
> ----

I think you would want to use the RESPONSE object directly, wouldn't you?

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

Cheers,

Tom P