diff options
author | adam <adam@> | 2021-02-12 13:24:33 +0200 |
---|---|---|
committer | adam <adam@> | 2021-02-12 13:24:33 +0200 |
commit | 077cab20146bf7cb26c330465fbd56cc0e0ddada (patch) | |
tree | cf686f7f1829b4da77f32cb5031fec16504efca4 /php/upload.php | |
parent | 527301b44e44e994c89ba4db47a49e37eaef4d1b (diff) | |
download | fileup-077cab20146bf7cb26c330465fbd56cc0e0ddada.tar.gz |
asdf
Diffstat (limited to 'php/upload.php')
-rw-r--r-- | php/upload.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/php/upload.php b/php/upload.php index 42a8bf6..b6cd335 100644 --- a/php/upload.php +++ b/php/upload.php @@ -2,20 +2,26 @@ require_once "database.php"; require_once "configuration.php"; -if (!isset( $_POST["filename"]) || !isset($_POST["the_file"])) +if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"])) { http_response_code(400); error_log("someone tried to upload something impropperly"); exit(1); } -$file = $_POST["the_file"]; +$file = $_FILES["the_file"]; $filename= $_POST["filename"]; -$codename=create_file_node($filename); - -copy($file['tmp_name'], "$storage_root/$codename"); +$codename=$database->create_file_node($filename); +if($codename=="error") +{ + http_response_code(400); + exit(0); +} +error_log($file['tmp_name']); +move_uploaded_file($file['tmp_name'], "$storage_root/$codename"); -echo $codename; +http_response_code(200); +exit(0); ?> |