From c62cf31b991b184d51f88928338e6a7a325c1c84 Mon Sep 17 00:00:00 2001 From: Fascinated Date: Sun, 9 Apr 2023 12:04:17 +0100 Subject: [PATCH] made the uploads dir confugurable --- upload.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/upload.php b/upload.php index 6c66f33..7ac0360 100644 --- a/upload.php +++ b/upload.php @@ -4,6 +4,7 @@ $before = microtime(true); // Start time of the script header('Content-type:application/json;charset=utf-8'); // Set the content type to JSON error_reporting(E_ERROR); // Hide PHP errors $tokens = array("set me"); // Your secret keys +$uploadDir = "./"; // The upload directory /** * Check if the token is valid @@ -55,8 +56,8 @@ if (in_array($fileType, array("png", "jpeg", "jpg"))) { $target_file = $webp_file; } -// Upload the file -if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $target_file)) { +// Move the file to the uploads folder +if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $uploadDir . $target_file)) { $timeTaken = microtime(true) - $before; returnJson('OK', $target_file, $timeTaken); } else {