log invaid upload permission/file

This commit is contained in:
Dennis Eichhorn 2020-09-06 21:13:04 +02:00
parent 4ff9b1f93e
commit d211936a37

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Orange Management * Orange Management
* *
@ -10,12 +11,13 @@
* @version 1.0.0 * @version 1.0.0
* @link https://orange-management.org * @link https://orange-management.org
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Modules\Media\Models; namespace Modules\Media\Models;
use phpOMS\System\File\FileUtils;
use phpOMS\System\File\Local\Directory; use phpOMS\System\File\Local\Directory;
use phpOMS\Log\FileLogger;
/** /**
* Upload. * Upload.
@ -169,7 +171,11 @@ class UploadFile
} }
if (!\is_dir($path)) { if (!\is_dir($path)) {
Directory::create($path, 0755, true); $created = Directory::create($path, 0755, true);
if (!$created) {
FileLogger::getInstance()->error('Couldn\t upload media file. There maybe is a problem with your permission or uploaded file.');
}
} }
if (!\rename($f['tmp_name'], $dest = $path . '/' . $this->fileName)) { if (!\rename($f['tmp_name'], $dest = $path . '/' . $this->fileName)) {