This commit is contained in:
Lee 2023-04-15 14:35:21 +01:00
parent f30df979c0
commit 478518ee59
2 changed files with 4 additions and 9 deletions

@ -9,10 +9,6 @@
<script src="https://cdn.fascinated.cc/assets/tailwindcss/3.2.4.js"></script> <script src="https://cdn.fascinated.cc/assets/tailwindcss/3.2.4.js"></script>
</head> </head>
<body> <body>
<!-- Centered div, vertial and horizontal -->
<!-- uploads file to upload.php, shows map id after upload, dont go to upload.php -->
<!-- use js -->
<!-- Modern design, dark mode -->
<div class="flex items-center justify-center h-screen bg-gray-900"> <div class="flex items-center justify-center h-screen bg-gray-900">
<div class="w-1/2"> <div class="w-1/2">
<div class="bg-gray-800 rounded-lg shadow-xl p-10"> <div class="bg-gray-800 rounded-lg shadow-xl p-10">
@ -26,7 +22,7 @@
name="map" name="map"
class="bg-gray-700 text-white font-bold py-2 px-4 rounded" class="bg-gray-700 text-white font-bold py-2 px-4 rounded"
/> />
<div class="flex items-center justify-center"> <div class="flex items-center justify-center ml-3">
<button <button
type="submit" type="submit"
name="submit" name="submit"

@ -22,16 +22,15 @@ function generateMapId()
function isZipFile($file) function isZipFile($file)
{ {
$fileType = strtolower(pathinfo($file, PATHINFO_EXTENSION)); $fileType = strtolower(pathinfo($file, PATHINFO_EXTENSION));
echo $fileType;
die();
return $fileType == "zip"; return $fileType == "zip";
} }
$mapId = generateMapId(); // the id of the map $mapId = generateMapId(); // the id of the map
$file = $_FILES["map"]["tmp_name"]; // the file to upload $map = $_FILES["map"]; // the file to upload
$file = $map["tmp_name"]; // the temporary file path
if (!isZipFile($file)) { if (!isZipFile($map["name"])) {
echo "The file is not a zip file"; echo "The file is not a zip file";
die(); die();
} }