[Zope] Downloading data

Michel Pelletier michel@digicool.com
Wed, 29 Sep 1999 13:03:23 -0400


> -----Original Message-----
> From: Jim Sanford [mailto:jsanford@atinucleus.com]
> Sent: Wednesday, September 29, 1999 12:43 PM
> To: ZOPE List
> Subject: [Zope] Downloading data
> 
> 
> I have a DTML document that produces 2 lines of text with a 
> CRLF at the end of
> each line. When saved to a file this is a comma delimited 
> merge file for a
> wordprocessing form letter.
> 
> Currently I have to right click on the link and then select 
> Save as... and then
> save the file to disk. How would I structure things in Zope 
> so that when I left
> click on the link instead of the 2 text lines showing up in 
> my browser window,
> it would download as a file instead?

Change the content type to something that triggers your browser to save
as a file.

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

or any other content-type which will cause your browser to save a file.
This must come at the very beginning of the document.

-Michel