A "file" type form will not give any "extension" field. In your exemple, the field "archive" will be an array with fields mime, tmp_name, name, size, error .. If you want to validate this, you woul have to extract the "extension" from the file name.. However, I would use the mime field to validate the type of field.
Some hints here: http://www.jonnyreeves.co.uk/2008/06/cakephp-uploaded-file-validation-in-models/ On Apr 12, 6:50 pm, pablosky <pablo00...@hotmail.com> wrote: > Hello, > > I have problems with file validation. I have several forms for > uploading files. The validation simply does not work. And all files > are loaded. For example, the simplest: > > var $validate = array( > 'archive' => array( > 'extension' => array( > 'rule' => array('extension', array('gif', 'jpeg', > 'png', 'jpg')), > 'message' => 'Error...' > ) > ) > ); > > The form: > > <?php > echo $this->Form->create('Archives', array('type' => 'file')); > echo $this->Form->input('archive', array('type' => 'file')); > echo $this->Form->submit(__('Save', true)); > echo $this->Form->end(); > ?> > > I do not understand because it is very simple. I do not understand > what does not. > > I do not know if anyone has had the same problem with file validation. > Or if you know where is the problem. > > Thank you very much -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php