[Zope] Content Disposition - Download files

Berthold Stöger blists at bdf-net.com
Mon Jun 26 13:31:15 EDT 2006


Hi,

On Monday 26 June 2006 12:46, Bruno Grampa wrote:
> Hello,
> i want to send an image or a pdf  to a browser not for viewing but for
> downloading.
> I've written this code:
> <dtml-call "RESPONSE.setHeader('Content-type',
> 'application/force-download')">
> <dtml-call "RESPONSE.setHeader('Content-Disposition', 'attachment;
> filename=filename.gif')">
>
> now i have to send the file as a binary flow, but i don't know how to
> do. Can you help me?

<dtml-call "RESPONSE.setHeader('Content-type', 'application/force-download')"
><dtml-call "RESPONSE.setHeader('Content-Disposition', 'attachment;filename=filename.gif')"
><dtml-var "_['filename.gif'].data">

But there is no reason why you wouldn't want to do that with a Python script.

HTH


More information about the Zope mailing list