0
<body>
    <div class="wrapper">

        <div class="header">
            <h1>Text2<span class="fancy">FairyTale</span></h1>
            <h4>Input: text, Output: <span class="fancy">fairy tale</span></h4>
        </div>

        <?php
            if ($_SERVER["REQUEST_METHOD"] == "POST") {

                echo "<pre>";
                print_r($_FILES);
                echo "</pre>";
                $filename = $_FILES["file-input"]["name"];
                $extension = pathinfo($filename, PATHINFO_EXTENSION);

                move_uploaded_file($_FILES["file-input"]["tmp_name"], $filename);
            }
        ?>

        <div class="upload-form">
            <form action="" method="post" encytype="multipart/form-data">
                <div class="upload">
                    <input type="file" name="file-input" class="file-input">
                    <input type="button" value="Browse">
                    <span class="filename">No file selected</span>
                </div>
                <input type="submit" name="submit" value="Upload">

                <span class="valid-formats">Valid input: .txt files &lt;= 512 KB</span>
            </form>
        </div>
    </div>
</body>
4

1 回答 1

4

你只写表单 Attribute Wrongly is Not encytype is enctype

 enctype="multipart/form-data" 
于 2013-02-02T19:06:23.143 回答