aboutsummaryrefslogtreecommitdiffstats
path: root/php/upload.php
diff options
context:
space:
mode:
authoradam <adam@>2021-02-12 20:47:42 +0200
committeradam <adam@>2021-02-12 20:47:42 +0200
commitfea0178c85cca6c95cdd8a92fe24c3fd81fec742 (patch)
treebc18fe7c1dc9581d95c3e1cacf41bb07bd5d7328 /php/upload.php
parent369de870ef6dbcd67ac9316bf714a6ded892eadc (diff)
downloadfileup-fea0178c85cca6c95cdd8a92fe24c3fd81fec742.tar.gz
checks if filename exists in the directory before creating the filenode
Diffstat (limited to 'php/upload.php')
-rw-r--r--php/upload.php5
1 files changed, 5 insertions, 0 deletions
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);