PHP development front-end upload form

First post the form code:

<html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<body>
<form action="upload.php" method="post"  enctype="multipart/form-data">
    <label for="file">文件名:</label>
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="submit" value="上传" />
</form>
</body>
</html>

This is actually a simple form, but it is worth noting that enctype="multipart/form-data", the enctype attribute specifies what to use when submitting the form Which content type, enctype="multipart/form-data" is to upload binary data; the input value in the form is passed in binary. This is the most important attribute in the upload function form, so pay attention to it.

Another thing to note is action="upload.php", method="post". Since it is uploading, there will be a place to upload it to and how to upload it. The attribute action="upload.php" is where the form content is sent.

method="post" is how to transfer data.

The form page is still very simple, but you have to try it yourself so that you can remember it deeply.

Continuing Learning
||
<html> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="format-detection" content="telephone=no" /> <body> <form action="upload.php" method="post" enctype="multipart/form-data"> <label for="file">文件名:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="上传" /> </form> </body> </html>
submitReset Code