user photo add

This commit is contained in:
2024-12-25 16:32:23 +03:00
parent 2790105a7d
commit b5b7befd34
18 changed files with 92 additions and 38 deletions

View File

@ -36,7 +36,9 @@ class FileUpload
$newFileName = md5(time() . $this->fileName) . '.' . $this->fileExtension;
if (in_array($this->fileExtension, $this->allowedFileExtensions)) {
$this->uploadDir = $uploadDir . mb_substr($newFileName, 0, 2) . '/' . mb_substr($newFileName, 2, 2) . '/';
mkdir(ROOT_DIR . $this->uploadDir, 0777, true);
$oldMask = umask(0);
mkdir(ROOT_DIR . $this->uploadDir, 0775, true);
umask($oldMask);
$uploadFileDir = ROOT_DIR . $this->uploadDir;
$this->destPath = $uploadFileDir . $newFileName;
$this->uploadFile = $this->uploadDir . $newFileName;
@ -49,7 +51,9 @@ class FileUpload
} else {
if (in_array($this->fileExtension, $this->allowedFileExtensions)) {
$this->uploadDir = $uploadDir;
mkdir(ROOT_DIR . $this->uploadDir, 0777, true);
$oldMask = umask(0);
mkdir(ROOT_DIR . $this->uploadDir, 0775, true);
umask($oldMask);
$uploadFileDir = ROOT_DIR . $this->uploadDir;
$this->destPath = $uploadFileDir . $this->fileName;
$this->uploadFile = $this->uploadDir . $this->fileName;