开发者

PHP Uploaded Filename not printing

开发者 https://www.devze.com 2023-04-04 05:14 出处:网络
This is simple and should work but doesn\'t, so I\'m obviously derping pretty hard somewhere. The uploaded file name should print after form submission.

This is simple and should work but doesn't, so I'm obviously derping pretty hard somewhere. The uploaded file name should print after form submission.

<?php
    if (isset($_POST["submit"])) {
        $name_of_uploaded_file = $_FILES['uploaded_file1']['name'];
        print($name_of_uploaded_file);
    }
?>

<form id="contactform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table>
        <tr>
            <td>
                <table>
                    <tr>
                        <td>
                            Attach Logo:
                        </td>
                        <td>
                            <input type="file" id="uploaded_file1" name="uploaded_file1" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
          <td>
            <input name="submit" id="submit" type="submit" value="Send" />
          </td>
开发者_开发技巧        </tr>
    </table>
</form>


You need the content encoding type set on your form open tag.

<form enctype="multipart/form-data" action="uploader.php" method="POST">
0

精彩评论

暂无评论...
验证码 换一张
取 消