[Zope-CMF] Archetypes question
Christian Theune
ct at gocept.com
Thu Feb 12 15:54:20 EST 2004
On Thu, 2004-02-12 at 08:42 -0500, bauer at mit.edu wrote:
> I am obviously missing something here...
>
> I created a new content type with Archetypes that has a filefield named
> File, and some other fields which contain related information. The
> filefield can take documents of various types (pdf, ps, doc, etc). I
> want to provide a view of this content type where users can download
> the file with the name that the file was uploaded with.
>
> Right now I am providing a href link to here/File which causing users
> browsers to try to save something of the name "File". Obviously not
> what I want.
I don't know if there is an Archetype helper for this, but I'm doing it
that way in generak:
create a wrapper method on your class like:
def downloadMyFile(self, REQUEST=None):
if REQUEST:
REQUEST.RESPONSE.setHeader("Content-
Disposition";"attachment;filename=%s" % originalname)
.
.
.
return self.myfileproperty
Actually I don't know where AT stores the original name of the file, but
this is the general approach. Also note, that IE 5.5 has a bug so it
can't interpret the filename in attachment dispositions.
Cheers,
Theuni
PS: What's the MIT doing with Zope? Is @mit.edu something
"important"? :)
--
Christian Theune, gocept gmbh & co. kg
http://www.gocept.com - ct at gocept.com
fon: 03496 3099112 fax: 03496 3099118 mobile: 0179 7808366
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-cmf/attachments/20040212/aee1a5e2/attachment.bin
More information about the Zope-CMF
mailing list