[Zope] verify file data field

Jens Vagelpohl jens@digicool.com
Thu, 01 Mar 2001 08:15:41 -0500


you're right, it doesn't care if it is empty because zope will always
construct a FileUpload object. so the test <dtml-if
"_.getitem(REQUEST['file']"> will always return "true" because
REQUEST['file'] will return the FileUpload object.

what you're looking for can be done by asking for the name that was put into
the input field. if that name is empty there was no upload. something like:

<dtml-if expr="REQUEST['file'].filename != ''">
  we have a file
</dtml-if>

jens


on 3/1/01 7:06, Andrei Belitski at andrei.belitski@student.uni-tuebingen.de
wrote:

> Hi!
> Anyone knows how to verify a formular file field if it's empty from ZOPE
> 
> e.g. (doesn't function)
> <INPUT TYPE="file" NAME="file" SIZE="50">
> ...
> <dtml-if "_.getitem(REQUEST['file']">
> getitem seem not to worry about if it were empty
> 
> Thank you in advance!
> Andrei
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>