Please, add this to your good extension
maxim-kn-akvilon opened this issue · 1 comments
maxim-kn-akvilon commented
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);
}
}
}
BioSin commented
Thank you for suggestions, this code FileUploadBehavior.php