[Zope] filefield value when empty

Chris Withers chrisw@nipltd.com
Tue Aug 5 11:25:15 EDT 2003


Marie Robichon wrote:
> 
> I figured this one out for myself and thought maybe someone would be 
> interested in the answer.  I found  that even when no value is added to 
> the field using the browse button, (and even despite defining a default 
> value)

You can't define default values for inputs of type "file". For security reasons, 
the browser will ignore any value supplied...

 > Therefore you
> have to check that the filename attribute of this fileupload instance 
> object is empty:
> 
> if getattr(file, 'filename')!="":
>    do something ........

Yup, that's the way to do it :-)

cheers,

Chris





More information about the Zope mailing list