fix filemanager

This commit is contained in:
alejandro.campos@artica.es 2024-02-26 12:55:17 +01:00
parent 421598df6b
commit e3f9d53775
1 changed files with 7 additions and 2 deletions

View File

@ -151,8 +151,13 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
// Copy file to directory and change name. // Copy file to directory and change name.
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename); $nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
try { try {
$ext = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION)); if (isset($_FILES['file']['type']) && empty($_FILES['file']['type']) === false) {
if (empty($filterFilesType) === true || in_array($ext, $filterFilesType) === true) { $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); $result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
} else { } else {
$types_allowed = implode(', ', $filterFilesType); $types_allowed = implode(', ', $filterFilesType);