From e3f9d5377568f77d371db9a200200d03f6fa979f Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 26 Feb 2024 12:55:17 +0100 Subject: [PATCH] fix filemanager --- pandora_console/include/functions_filemanager.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 442c2a2f30..a0194cf31d 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -151,8 +151,13 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_ // Copy file to directory and change name. $nombre_archivo = sprintf('%s/%s', $real_directory, $filename); try { - $ext = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION)); - if (empty($filterFilesType) === true || in_array($ext, $filterFilesType) === true) { + if (isset($_FILES['file']['type']) && empty($_FILES['file']['type']) === false) { + $type = $_FILES['file']['type']; + } else { + $type = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION)); + } + + if (empty($filterFilesType) === true || in_array($type, $filterFilesType) === true) { $result = copy($_FILES['file']['tmp_name'], $nombre_archivo); } else { $types_allowed = implode(', ', $filterFilesType);