Closed maxim-kn-akvilon closed 7 years ago
class CustomImageUploadBehavior extends ImageUploadBehavior {
/** * @var bool */ public $deleteTempFile = true; /** * @throws Exception */ public function afterSave() { if ($this->file instanceof UploadedFile) { $path = $this->getUploadedFilePath($this->attribute); FileHelper::createDirectory(pathinfo($path, PATHINFO_DIRNAME), 0775, true); if (!$this->file->saveAs($path, $this->deleteTempFile)) { throw new Exception('File saving error.'); } $this->owner->trigger(static::EVENT_AFTER_FILE_SAVE); } }
}
Thank you for suggestions, this code FileUploadBehavior.php
class CustomImageUploadBehavior extends ImageUploadBehavior {
}