fix for #1356
This commit is contained in:
parent
72d89576f1
commit
594ba12ea3
2 changed files with 8 additions and 1 deletions
|
@ -566,8 +566,11 @@ function uploadPageFile($pageKey) {
|
||||||
$filename = Filesystem::filename($_FILES['file']['name']);
|
$filename = Filesystem::filename($_FILES['file']['name']);
|
||||||
$absoluteURL = DOMAIN_UPLOADS_PAGES.$pageKey.DS.$filename.'.'.$fileExtension;
|
$absoluteURL = DOMAIN_UPLOADS_PAGES.$pageKey.DS.$filename.'.'.$fileExtension;
|
||||||
$absolutePath = PATH_UPLOADS_PAGES.$pageKey.DS.$filename.'.'.$fileExtension;
|
$absolutePath = PATH_UPLOADS_PAGES.$pageKey.DS.$filename.'.'.$fileExtension;
|
||||||
|
// Move the original file to a page folder
|
||||||
if (Filesystem::mv($_FILES['file']['tmp_name'], $absolutePath)) {
|
if (Filesystem::mv($_FILES['file']['tmp_name'], $absolutePath)) {
|
||||||
// Create thumbnail if the files is an image
|
// Change permissions files to rw-r-r
|
||||||
|
Filesystem::chmod($absolutePath, 0644);
|
||||||
|
// Create the thumbnails only if the file is an image
|
||||||
$thumbnail = '';
|
$thumbnail = '';
|
||||||
if (in_array($fileMimeType, $GLOBALS['ALLOWED_IMG_MIMETYPES'])) {
|
if (in_array($fileMimeType, $GLOBALS['ALLOWED_IMG_MIMETYPES'])) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -319,4 +319,8 @@ class Filesystem {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function chmod(string $file, int $permissions): bool {
|
||||||
|
return chmod($file, $permissions);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue