in my project having upload image if i select image it goes to database with out select image if i click on create button validation is not working
contorller:
public function actionCreate()
{
$model=new Admission;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Admission']))
{
$model->attributes=$_POST['Admission'];
$model->image=CUploadedFile::getInstance($model,'image');
if($model->save())
$model->image->saveAs(Yii::app()->basePath .'/images/' . $model->image);
//$model->image->saveAs(Yii::getPathOfAlias('webroot').'/files/'.$model->image);
$this->redirect(array('view','id'=>$model->studentid));
}
$this->render('create',array(
'model'=>$model,
));
}
model:
return array(
array('image', 'file', 'types'=>'jpg, gif, png'),
array('studentfname, studentlname, dateofjoining, class, course, dob, age, gender, previousinstitutename, Fathername, parentorguardian_occupation, relation_w_student, address, city, state, country, pincode, mobile, Relegion, category,image', 'required'),
}
in this controller if write save as function validation not working in form