how can I force download of a word document as a file and not have it calling word?
When I have a file object that contains a word doc "viewing" it fires up word and displays the document. What I really want is that the save file dialog is presented. So how can I suppress the default behavior? Robert
Robert Rottermann wrote:
When I have a file object that contains a word doc "viewing" it fires up word and displays the document. What I really want is that the save file dialog is presented. So how can I suppress the default behavior?
You can set the content-type of the RESPONSE to application/octet-stream. Example: <dtml-call "REQUEST['RESPONSE'].setHeader('content-type','application/octet-stream')"> Andreas Heckel andreas@easyleading.org
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. ----- Original Message ----- From: "Andreas Heckel" <andreas@easyleading.org> To: "Robert Rottermann" <robert@redcor.ch> Cc: <zope@zope.org> Sent: Monday, April 15, 2002 1:28 PM Subject: Re: [Zope] how can I force download of a word document as a file and not have it calling word?
Robert Rottermann wrote:
When I have a file object that contains a word doc "viewing" it fires up word and displays the document. What I really want is that the save file dialog is presented. So how can
I
suppress the default behavior?
You can set the content-type of the RESPONSE to application/octet-stream. Example:
<dtml-call
"REQUEST['RESPONSE'].setHeader('content-type','application/octet-stream')">
Andreas Heckel andreas@easyleading.org
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
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. cheers, oliver
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
[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
It's not a Windows problem ... it's an IE issue. And as fare as I know M$ is not willing to change this behaviour :-( 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.
Robert Rottermann wrote:
When I have a file object that contains a word doc "viewing" it fires up word and displays the document. What I really want is that the save file dialog is presented. So how can
I
suppress the default behavior?
You can set the content-type of the RESPONSE to application/octet-stream. Example:
<dtml-call
"REQUEST['RESPONSE'].setHeader('content-type','application/octet-stream')">
[Andreas Heckel]
It's not a Windows problem ... it's an IE issue. And as fare as I know M$ is not willing to change this behaviour :-(
You could probably change this by judicious registry editing, but it would only help on your own machine, so it's probably not a solution for you. However, with IE you can right-click and save the document, so it can be gotten even if it's not the default behavior. Cheers, Tom P
It's a browser function. The browser recognizes the mime-type and knows it has a viewer (MSWord) and fires off the viewer. You have to modify the browser settings. On Mon, 15 Apr 2002, Robert Rottermann wrote:
When I have a file object that contains a word doc "viewing" it fires up word and displays the document. What I really want is that the save file dialog is presented. So how can I suppress the default behavior?
Robert
participants (7)
-
Andreas Heckel -
Barry Pederson -
Dennis Allison -
Oliver Bleutgen -
Phil Harris -
Robert Rottermann -
Thomas B. Passin