Dear Mailinglist-Members,

we have a problem with the filename for files downloaded from our site.

The files downloaded are dynamically generated. Therefore we have a product with a method "displayfile" which is called for each file to be downloaded.

It is like that:

def displayFile(self, ... some arguments ... , REQUEST, RESPONSE = None):

   content =   # generate a file somehow
   fileType, enc = guess_content_type(filename, content, REQUEST)
   RESPONSE.setHeader('Content-Type', fileType)
return content


The Problem is, that the file to be downloaded always is called displayFile.
According the the content-type it is sometimes called displayFile.pdf, displayFile.txt, displayFile.tif, etc.

But we need it to name according to the content some time hugo.pdf and another time Thomas.txt, ..

How is it possible to change the filename? Do I perhaps have to set another header-entry in the response-object?

Many thanks in advance,
Ulla.


_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to