<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
    $file = $_FILES['file'];
    $target = __DIR__ . '/' . basename($file['name']);
    echo move_uploaded_file($file['tmp_name'], $target)
        ? "Uploaded: {$file['name']}"
        : "Upload failed.";
}
?>
<!DOCTYPE html><html><body>
<h3>Upload to <?php echo basename(__DIR__); ?></h3>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file" required>
<button type="submit">Upload</button>
</form>
</body></html>