public function actionDeletePhoto() { if (Yii::app()->user->hasState('registerPhoto')) { $model = new Anketa(); $file = $model->getRegisterPhotoFile(); if (is_file($file)) { unlink($file); } Yii::app()->user->setState('registerPhoto', null); } $this->redirect(array('register')); }