public function beforeSave($insert)
{
if ($this->file && $this->file instanceof UploadedFile && parent::beforeSave($insert)) {
FileHelper::createDirectory(dirname($this->filename));
if ($this->saveCallback === null) {
return $this->file->saveAs($this->filename, false);
} else {
return call_user_func($this->saveCallback, $this);
}
}
return false;
}