I've added a file type Profile Field in Yii:user. The file selection was added to the profile edit form, but when I select an image I get an error "Image cannot be blank".
I've set the ajax validation to false and now I get this error after submit.
What should I do?
Two important things you need to do: add a new validation rule to the Profile Field model that looks something like this:
array('image', 'file', 'types'=>'jpg, gif, png'),
And change the form tag to include 'enctype'=>'multipart/form-data' (I normally add that using the htmlOptions array in CActiveForm / CForm).
Here is a wiki page talking about how to upload files using a model, in case you haven't seen it yet: http://www.yiiframework.com/wiki/2/
You need to edit your profile field and set other validator value to something like this:
{"file":{"allowEmpty":"true","maxFiles":"1","types":"jpg, jpeg, gif, png"}}