diff --git a/bl-kernel/ajax/upload-images.php b/bl-kernel/ajax/upload-images.php index cebc0d50..ca672028 100644 --- a/bl-kernel/ajax/upload-images.php +++ b/bl-kernel/ajax/upload-images.php @@ -44,6 +44,7 @@ foreach ($_FILES['bluditInputFiles']['name'] as $key=>$filename) { // Check file extension $fileExtension = pathinfo($filename, PATHINFO_EXTENSION); + $fileExtension = Text::lowercase($fileExtension); if (!in_array($fileExtension, $allowedExtensions) ) { $message = 'Extension file not supported.'; Log::set($message, LOG_TYPE_ERROR); @@ -53,7 +54,7 @@ foreach ($_FILES['bluditInputFiles']['name'] as $key=>$filename) { ))); } - // Get the next filename to not overwrite the original file + // Generate the next filename to not overwrite the original file $nextFilename = Filesystem::nextFilename($uploadDirectory, $filename); // Move from temporary directory to uploads folder diff --git a/bl-kernel/helpers/filesystem.class.php b/bl-kernel/helpers/filesystem.class.php index 7841dfb7..d41740f3 100644 --- a/bl-kernel/helpers/filesystem.class.php +++ b/bl-kernel/helpers/filesystem.class.php @@ -206,8 +206,8 @@ class Filesystem { // Returns the next filename if the filename already exist public static function nextFilename($path=PATH_UPLOADS, $filename) { // Clean filename and get extension - $filename = Text::lowercase($filename); $fileExtension = pathinfo($filename, PATHINFO_EXTENSION); + $fileExtension = Text::lowercase($fileExtension); $filename = pathinfo($filename, PATHINFO_FILENAME); $filename = Text::replace(' ', '', $filename); $filename = Text::replace('_', '', $filename); diff --git a/bl-kernel/helpers/image.class.php b/bl-kernel/helpers/image.class.php index 610117eb..0557c5db 100644 --- a/bl-kernel/helpers/image.class.php +++ b/bl-kernel/helpers/image.class.php @@ -28,15 +28,13 @@ class Image { $path_complete = $filename.'.'.$extension; - if($forcePNG) { + if ($forcePNG) { $extension = 'png'; - } - elseif($forceJPG) { + } elseif ($forceJPG) { $extension = 'jpg'; } - switch($extension) - { + switch ($extension) { case 'jpg': case 'jpeg': // Checking for JPG support