[Zope] Re: [Projet-zf] Download a file from a form
Nick Garcia
ngarcia@codeit.com
Wed, 05 Apr 2000 11:15:18 -0700
FR Chalaoux wrote:
>
> Hi,
>
> I fixed the problem :
>
> getPDB method
> =============
> <dtml-var "getfiles(REQUEST, REPONSE)">
>
> getfiles.py Extension file
> ===========================
> def getfiles(self, REQUEST['ids'], RESPONSE):
> PickleJar = Trinket('/me/foo-ids.gz','x/gzip')
> PickleJar.download(RESPONSE)
> blah, blah ...
>
> But now , when I save the file the filename is getPDB (getPDB method is took in
> fact), not the name of my downloaded file.
Modify download like so:
def download(self, RESPONSE):
RESPONSE['Content-type']=self.type
RESPONSE['Content-Disposition'] = 'attachment; filename=%s' %
name_of_the_file);
return open(self.path).read()
You'll of course have to find a way to get the name of the file there
instead of name_of_the_file, but I'm sure that's not too difficult :)
--
Nick Garcia | ngarcia@codeit.com
CodeIt Computing | http://codeit.com