views:

104

answers:

1

How validate file upload in CakePHP? When i wrote some like this:

var $validate = array(
    'file' => array(
        'select' => array(
            'rule' => array('selectFile'),
            'message' => 'There is no file!'),
        'type' => array(
            'rule' => array('typeFile'),
            'message' => 'Bad type!'),
        'size' => array(
            'rule' => array('sizeFile'),
            'message' => 'Bad with size!')));
Works only with the last validate, here 'size'. Maybe You know solution, for validation for files with many messages?

A: 

try adding required=true to each of the 3 rules

Funky Dude
I found solution: http://www.openwritings.net/content/execution-order-multiple-validation-rules
kicaj