[Zope] Setting default filename for download

Dieter Maurer dieter@handshake.de
Mon, 24 Mar 2003 20:00:11 +0100


Andreas Tille wrote at 2003-3-24 15:51 +0100:
 > I want to offer some PDF documents for download by a script.  I do this
 > by
 > 
 >     response = container.REQUEST.RESPONSE
 > 
 >     pdf  = <some code>
 >     name = <some reasonable name for this pdf>
 > 
 >     response.setHeader('Content-type', 'application/pdf' )
 >     response.setHeader('Content-Length', len(pdf))
 >     return pdf
 > 
 > I just want to realize that the downloader gets a sane default name for
 > the file to download which is stored in the variable "name" instead of
 > just the name of the script which returns the pdf.
 > 
 > How can I specify this?

Search (Google) for "Content-Disposition".


Dieter