[Product-Developers] Getting filename from FileField in custom AT content type

Khairil Yusof kaeru at inigo-tech.com
Mon Jan 19 04:07:41 UTC 2009

On Fri, 2009-01-16 at 13:14 +0800, Khairil Yusof wrote:
> I have an AT type with a FileField called attachment1 with an uploaded
> file.
> Getting MIMETypes is ok.
> obj.attachment1.getContentType() 
> but the following returns None,
> obj.attachment1.getFilename() 
> It shows up ok in ZPT (accessor/filename) but I can't seem to access it
> via python. 
> I'm probably missing something obvious here, but can somebody help point
> to me where this value is is stored and how do I access it?

Silly me.

Doing a dir(obj.attachment1) shows it has attribute filename. This will
do it, in unlikely case somebody stumbles onto this problem:

filename = obj.attachment1.filename

More information about the Product-Developers mailing list