Hi!

You should use separate .yml to validate file upload;

http://www.symfony-project.org/book/1_1/10-Forms#Complex%20Validation
, Look for "Using Array Syntax for Form Fields"
You can use same name on form field name and inside the brackets
example : name="image[image]". Then you can add to .yml file:

fields:
  image{image}:
    file:       True
    required:
      msg:      Please select file to upload

On Dec 23 2008, 5:33 pm, valytud <valy...@gmail.com> wrote:
> Hello,
>
> Does anybody know how to validate properly array of html form inputs?
> Let's say we have more than one input file fileds with the name "file
> []" (I mean
> a form array) then you want to validate all this fields.
>
> If you try to validate this, there will be a required error message
> throw exception,
> because the parameter passed isn't interperted as an array in this
> case.
>
> This thing was not calculated when the form framework was done.
>
> Eg.:
>
> $this->widgetSchema['file[]'] = new sfWidgetFormInputFile();
>     $this->validatorSchema['file[]'] = new sfValidatorFile(array
> ('mime_types' => array('image/jpeg',
>         'image/pjpeg',
>         'image/png',
>         'image/x-png',
>         'image/gif'), 'required' => true), array('mime_types' => 'Mime
> type invalid (%mime_type%). Doar fisierele JPG, PNG sau GIF sunt
> permise', 'required' => 'Selectati un fisier.'));

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to