Merge branch 'ent-12938-File-manager-no-funciona-correctamente' into 'develop'

Ent 12938 file manager no funciona correctamente

See merge request artica/pandorafms!6967
This commit is contained in:
Rafael Ameijeiras 2024-02-26 16:29:19 +00:00
commit cf517cd963
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.
$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']) === true && 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);