[Zope] Content Disposition - Download files

Tino Wildenhain tino at wildenhain.de
Mon Jun 26 06:59:21 EDT 2006


Bruno Grampa schrieb:
> 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?
> 

Do you plan to always send the file for download?
Then you just put a script name into "precondition"
field of the object. The script could be something
like:

(Python script)

context.REQUEST.RESPONSE.setHeader('Content-Disposition','attachment; filename=%s' % 
context.getId())


Regards
Tino Wildenhain


More information about the Zope mailing list