aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Vitkov <alexvitkov98@gmail.com>2021-02-15 12:16:08 +0200
committerAlex Vitkov <alexvitkov98@gmail.com>2021-02-15 12:16:08 +0200
commitb73b92de00f4766b7974e05feeffc28abc8152f4 (patch)
tree5cab7273d550892616d512fdaa80cdf969c599a5
parentd597a9d399f89b51483274c80d771b44905d275f (diff)
downloadfileup-b73b92de00f4766b7974e05feeffc28abc8152f4.tar.gz
unlink b4 move_uploaded_file
-rw-r--r--loggedin.js2
-rw-r--r--php/upload.php1
2 files changed, 2 insertions, 1 deletions
diff --git a/loggedin.js b/loggedin.js
index 2b1f2c0..d328351 100644
--- a/loggedin.js
+++ b/loggedin.js
@@ -142,6 +142,7 @@ function on_file_added(_e) {
filename_input.value = override_file_filename;
override_input.value = "1";
upload_parent_directory.value = override_file_path;
+ console.log(filename_input.value, override_input.value, upload_parent_directory.value);
} else {
filename_input.value = the_file.files[0].name;
override_input.value = "0";
@@ -398,7 +399,6 @@ function opendir() {
files = [];
var json = JSON.parse(xhr.responseText);
- console.log(json);
if (!json)
return;
diff --git a/php/upload.php b/php/upload.php
index a4f816f..def98b3 100644
--- a/php/upload.php
+++ b/php/upload.php
@@ -41,6 +41,7 @@ if($codename=="filename taken" && $overwrite!=1)
http_response_code(409);
exit(0);
}
+unlink("$storage_root/$codename");
move_uploaded_file($file['tmp_name'], "$storage_root/$codename");
http_response_code(200);