From b9e3cd9812267eb2defb6310d5809616bbf44e39 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 16 Feb 2023 12:01:34 +0100 Subject: [PATCH] add verification if file already uploaded --- htdocs/core/ajax/flowjs-server.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index cb66ad884ae..918871421d3 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -80,7 +80,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } } else { // loop through files and move the chunks to a temporarily created directory - if (!empty($_FILES)) foreach ($_FILES as $file) { + if (file_exists($upload_dir.'/'.$flowFilename)) { + echo json_encode('File '.$flowIdentifier.' was already uploaded'); + header("HTTP/1.0 200 Ok"); + } else if (!empty($_FILES)) foreach ($_FILES as $file) { // check the error status if ($file['error'] != 0) { dol_syslog('error '.$file['error'].' in file '.$flowFilename);