protected function afterSave() { if ($this->_scenario == self::SC_INSERT) { $this->_uploadedFile->saveAs($this->getFilePath(true)); } if ($this->scenario == self::SC_DELETE_ACTION) { $file = $this->getFilePath(); if (file_exists($file)) { unlink($file); } } }