diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 3e2438f63d3..9a37eb17e12 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -38,7 +38,7 @@ if (GETPOST('uploadform', 'int') && empty($_POST) && empty($_FILES)) { // Submit file/link if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC) && (!isset($permissiontoadd) || $permissiontoadd)) { - if (!empty($_FILES)) { + if (!empty($_FILES) && is_array($_FILES['userfile'])) { if (is_array($_FILES['userfile']['tmp_name'])) { $userfiles = $_FILES['userfile']['tmp_name']; } else { diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 813ee69b6fb..d9e5291c2dc 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -102,10 +102,13 @@ if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC)) } $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; - if (is_array($_FILES['userfile']['tmp_name'])) { - $userfiles = $_FILES['userfile']['tmp_name']; - } else { - $userfiles = array($_FILES['userfile']['tmp_name']); + $userfiles = []; + if (is_array($_FILES['userfile'])) { + if (is_array($_FILES['userfile']['tmp_name'])) { + $userfiles = $_FILES['userfile']['tmp_name']; + } else { + $userfiles = array($_FILES['userfile']['tmp_name']); + } } foreach ($userfiles as $key => $userfile) { diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 9264400a71f..8b158f86dc4 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -97,7 +97,7 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { $checked = ''; //var_dump(GETPOST($file['relativename'])); var_dump($file['relativename']); var_dump($_FILES['userfile']['name']); // If a file was just uploaded, we check to preselect it - if (is_array($_FILES['userfile']['name'])) { + if (is_array($_FILES['userfile']) && is_array($_FILES['userfile']['name'])) { foreach ($_FILES['userfile']['name'] as $tmpfile) { if ($file['relativename'] == (GETPOST('savingdocmask', 'alpha') ? dol_sanitizeFileName($object->ref.'-') : '').$tmpfile) { $checked = ' checked'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b7062b4f599..772832ea2cc 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2221,7 +2221,7 @@ if ($action == 'importsiteconfirm' && $usercanedit) { $fileofzip = ''; if (GETPOSTISSET('templateuserfile')) { $fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha'); - } elseif (!empty($_FILES)) { + } elseif (!empty($_FILES) && is_array($_FILES['userfile'])) { if (is_array($_FILES['userfile']['tmp_name'])) { $userfiles = $_FILES['userfile']['tmp_name']; } else {