aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradam <adam@>2021-02-15 12:01:01 +0200
committeradam <adam@>2021-02-15 12:01:01 +0200
commit36d193908bc32a09a3253b3024be6520063361b5 (patch)
treef3c97e96ed399154f8d4f8cd1f4ec9f14335574f
parente4dbef0a89f612d294810d55dbb96539cf992d60 (diff)
downloadfileup-36d193908bc32a09a3253b3024be6520063361b5.tar.gz
tries to overwrite file now ( pre permission checking TODO)
-rw-r--r--php/upload.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/php/upload.php b/php/upload.php
index 97fbf2f..a4f816f 100644
--- a/php/upload.php
+++ b/php/upload.php
@@ -6,7 +6,7 @@ require_once "user.php";
require_once "node.php";
session_start();
-if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"]) || !isset($_POST['parent_directory']))
+if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"]) || !isset($_POST['parent_directory']) || !isset($_POST['overwrite']))
{
error_log("someone tried to upload something impropperly");
http_response_code(400);
@@ -19,6 +19,7 @@ $parent_directory=$_POST["parent_directory"];
$user=$_SESSION['user_object'];
$homedir=$user->home_directory;
$mimetype=file_type($file['tmp_name']);
+$overwrite=$_POST['overwrite'];
$dir = get_directory($parent_directory, $user);
if (!$dir)
@@ -35,7 +36,7 @@ if($codename=="error")
http_response_code(409);
exit(0);
}
-if($codename=="filename taken")
+if($codename=="filename taken" && $overwrite!=1)
{
http_response_code(409);
exit(0);