forked from Wavyzz/dolibarr
check if $_FILES['userfile'] is an array before getting values (#26269)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user