forked from Wavyzz/dolibarr
Add protection on upload if file already exists
This commit is contained in:
@@ -79,7 +79,7 @@ if ($_POST["sendit"] && $conf->upload)
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
{
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']))
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0) > 0)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
//print_r($_FILES);
|
||||
|
||||
@@ -57,19 +57,20 @@ if ($_POST["action"] == 'infotrans')
|
||||
{
|
||||
$dir = $conf->prelevement->dir_output.'/bon/';
|
||||
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name']))
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name'],1) > 0)
|
||||
{
|
||||
$dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
||||
$dt = dolibarr_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
||||
|
||||
$bon->set_infotrans($user, $dt, $_POST["methode"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Fichier invalide",LOG_WARN);
|
||||
dolibarr_syslog("Fichier invalide",LOG_WARNING);
|
||||
}
|
||||
|
||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'infocredit')
|
||||
|
||||
Reference in New Issue
Block a user