Try fix for #17094
This commit is contained in:
parent
000510a562
commit
6fc19c626d
@ -524,15 +524,15 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
* Action of adding a file in email form
|
||||
*/
|
||||
if (!empty($_POST['addfile'])) {
|
||||
if (GETPOST('addfile')) {
|
||||
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
dol_add_file_process($upload_dir, 0, 0);
|
||||
dol_add_file_process($upload_dir, 0, 0, 'addedfile', '', null, '', 0);
|
||||
|
||||
$action = "edit";
|
||||
}
|
||||
@ -543,7 +543,7 @@ if (empty($reshook)) {
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_remove_file_process($_POST['removedfile'], 0, 0); // We really delete file linked to mailing
|
||||
dol_remove_file_process(GETPOST('removedfile'), 0, 0); // We really delete file linked to mailing
|
||||
|
||||
$action = "edit";
|
||||
}
|
||||
@ -1216,7 +1216,7 @@ if ($action == 'create') {
|
||||
$out .= '<br></div>';
|
||||
}
|
||||
} else {
|
||||
$out .= $langs->trans("NoAttachedFiles").'<br>';
|
||||
$out .= '<span class="opacitymedium">'.$langs->trans("NoAttachedFiles").'</span><br>';
|
||||
}
|
||||
// Add link to add file
|
||||
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||
|
||||
@ -1544,7 +1544,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
if (!empty($_FILES[$varfiles])) { // For view $_FILES[$varfiles]['error']
|
||||
dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG);
|
||||
|
||||
if (dol_mkdir($upload_dir) >= 0) {
|
||||
$result = dol_mkdir($upload_dir);
|
||||
// var_dump($result);exit;
|
||||
if ($result >= 0) {
|
||||
$TFile = $_FILES[$varfiles];
|
||||
if (!is_array($TFile['name'])) {
|
||||
foreach ($TFile as $key => &$val) {
|
||||
@ -1647,6 +1649,8 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
$res = 1;
|
||||
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFailedToCreateDir", $upload_dir), null, 'errors');
|
||||
}
|
||||
} elseif ($link) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user