public function beforeSave($event)
{
if ($this->checkScenario() && $this->getUploadedFileInstance() instanceof CUploadedFile) {
$this->removeFile();
$this->saveFile();
}
if ($this->checkScenario() && Yii::app()->getRequest()->getPost($this->deleteFileKey)) {
$this->removeFile();
$this->getOwner()->{$this->attributeName} = null;
}
parent::beforeSave($event);
}