Bug fix for #868, allow upload file extension with upper case letters

This commit is contained in:
Diego Najar 2018-11-21 18:48:34 -03:00
parent ccfb02c0ac
commit 45d725c909
3 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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);

View File

@ -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