diff --git a/bl-kernel/admin/themes/booty/html/media.php b/bl-kernel/admin/themes/booty/html/media.php index 4249f865..aff51a2d 100644 --- a/bl-kernel/admin/themes/booty/html/media.php +++ b/bl-kernel/admin/themes/booty/html/media.php @@ -37,6 +37,8 @@ $numberOfPages = count($listOfFilesByPage); -->

p('Upload'); ?>

+ +
@@ -97,6 +99,14 @@ function cleanTable() { $('#jsbluditMediaTable').empty(); } +function showMediaAlert(message) { + $("#jsalertMedia").html(message).removeClass('d-none'); +} + +function hideMediaAlert() { + $("#jsalertMedia").addClass('d-none'); +} + // Show the files in the table function displayFiles(files) { if (!Array.isArray(files)) { @@ -143,6 +153,8 @@ function getFiles(pageNumber) { function(data) { // success function if (data.status==0) { displayFiles(data.files); + } else { + console.log(data.message); } } ); @@ -158,6 +170,8 @@ function deleteMedia(filename) { function(data) { // success function if (data.status==0) { getFiles(1); + } else { + console.log(data.message); } } ); @@ -211,6 +225,9 @@ $(document).ready(function() { $("#jsbluditProgressBar").width("0"); // Get the files for the first page, this include the files uploaded getFiles(1); + } else { + $("#jsbluditProgressBar").width("0"); + showMediaAlert(data.message); } }); }); diff --git a/bl-kernel/ajax/upload-images.php b/bl-kernel/ajax/upload-images.php index 9d799795..7351d8d3 100644 --- a/bl-kernel/ajax/upload-images.php +++ b/bl-kernel/ajax/upload-images.php @@ -34,7 +34,7 @@ foreach ($_FILES['bluditInputFiles']['name'] as $key=>$filename) { // Check for errors if ($_FILES['bluditInputFiles']['error'][$key] != 0) { - $message = 'Error occurred uploading the image, max file size allowed: '.ini_get('upload_max_filesize'); + $message = $L->g('Maximum load file size allowed:').' '.ini_get('upload_max_filesize'); Log::set($message, LOG_TYPE_ERROR); ajaxResponse(1, $message); } @@ -46,7 +46,7 @@ foreach ($_FILES['bluditInputFiles']['name'] as $key=>$filename) { $fileExtension = pathinfo($filename, PATHINFO_EXTENSION); $fileExtension = Text::lowercase($fileExtension); if (!in_array($fileExtension, $allowedExtensions) ) { - $message = 'Extension file not supported.'; + $message = $L->g('File type is not supported. Allowed types:').' '.implode(', ',$allowedExtensions); Log::set($message, LOG_TYPE_ERROR); ajaxResponse(1, $message); } diff --git a/bl-languages/en.json b/bl-languages/en.json index 9c03dace..974a0c2d 100644 --- a/bl-languages/en.json +++ b/bl-languages/en.json @@ -376,5 +376,7 @@ "thumbnail": "Thumbnail", "thumbnail-width-in-pixels": "Thumbnail width in pixels (px).", "thumbnail-height-in-pixels": "Thumbnail height in pixels (px).", - "thumbnail-quality-in-percentage": "Thumbnail quality in percentage (%)." + "thumbnail-quality-in-percentage": "Thumbnail quality in percentage (%).", + "maximum-load-file-size-allowed:": "Maximum load file size allowed:", + "file-type-is-not-supported": "File type is not supported. Allowed types:" } \ No newline at end of file