jrbasso/MeioUpload

validation

dogmatic69 opened this issue · 3 comments

doing it according to the docs i can find it does not work

                'Empty' => array(
                    'check' => false
                )

is there another way or is it broken?

im doing this in the mean time

    function beforeFilter(){
        parent::beforeFilter();

        if(isset($this->data['Image'][0]['image']['name']) && empty($this->data['Image'][0]['image']['name'])){
            unset($this->data['Image']);
        }
    }

You tried with master or 3.0 version?

does not seem like it, will upgrade and check think im on 2.1

I had trouble getting this working in MeioUpload 2.2 (CakePHP 1.2) also, but mainly due to a lack of documentation.

To disable a validation rule on my file upload field, I had to set the validation rule in the model that the field belonged to. I was trying to set the validation in the MeioUpload behavior settings, which is why it wasn't working.

For a file upload form field like this:
echo $form->input('News.image', array('type' => 'file'));

I had to put this in my News model:
var $validate = array('image' => array( 'Empty' => array('check' => false)));