From fea0178c85cca6c95cdd8a92fe24c3fd81fec742 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 12 Feb 2021 20:47:42 +0200 Subject: checks if filename exists in the directory before creating the filenode --- php/upload.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'php/upload.php') diff --git a/php/upload.php b/php/upload.php index ee5d1ae..1672e9e 100644 --- a/php/upload.php +++ b/php/upload.php @@ -25,6 +25,11 @@ if($codename=="error") http_response_code(400); exit(0); } +if($codename=="filename taken") +{ + http_response_code(409); + exit(0); +} move_uploaded_file($file['tmp_name'], "$storage_root/$codename"); http_response_code(200); -- cgit v1.2.3