diff --git a/index.html b/index.html index 591f25b..29f5d2b 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,8 @@ - + +
diff --git a/upload.php b/upload.php index 7e59112..cf16936 100644 --- a/upload.php +++ b/upload.php @@ -16,22 +16,13 @@ function generateMapId() return $mapId; } -/** - * Return a JSON response - */ -function returnJson($data): void -{ - echo (json_encode($data)); - die(); -} - - /** * Checks if the file is a zip file */ function isZipFile($file) { $fileType = strtolower(pathinfo($file, PATHINFO_EXTENSION)); + echo $fileType; return $fileType == "zip"; } @@ -42,18 +33,12 @@ $file = $map["tmp_name"]; if (!isZipFile($file)) { echo "The file is not a zip file"; - return; + die(); } $target_file = $target_dir . $mapId . ".zip"; -if (move_uploaded_file($file, $target_file)) { - returnJson([ - "status" => "success", - "mapId" => $mapId - ]); -} else { - returnJson([ - "status" => "error", - "message" => "An error occurred while uploading the file" - ]); +if (!move_uploaded_file($file, $target_file)) { + echo "There was an error uploading the file"; + die(); } +echo "The file https://wip.fascinated.cc/maps/" . $mapId . ".zip has been uploaded.";