[html-formfu] File upload and constraints / validators
Tobias Henoeckl
hoeni-formfu at sisyphus.de
Tue Jan 8 10:42:52 GMT 2008
Hi there,
I'm building a form containing a file upload field with the FormFu
Catalyst controller.
Now I need to check the file size so I can keep users from uploading
zero-sized files.
I tried to build a custom constraint or validator to check for that, but
can't see a way provided to access the file or its attributes (usually
in Catalyst via $c->req->upload('fieldname') within a constrain() or
validate() method.
Any ideas how to workaround this? How can I trigger an error for the
upload field in the Catalyst controller (which wouldn't very very
elegant though)?
Shouldn't basic checking of uploaded Files be realizeable in a Validator
or Constraint, e.g. type checking, virus checking, etc? That could offer
a great code reusability...
cheers, Hoeni
More information about the HTML-FormFu
mailing list