I want file upload optional in my form. In my model file, in ‘rules’ I have coded:
array('imageData','file','types'=>'jpg')
,
but I have not included image data in the ‘required’ rule. And I am not storing the uploaded file in DB. But if I submit a form without the uploaded image, I get the validation error that ‘upload file is required’.
The program works fine if I comment out the above code, but then I cannot validate the file type. Any help is welcome.