PHP development image upload introduction

Image uploading is a very common function during our development process, but many novices don’t know how to upload images. Today we will lead you to do a simple image upload with displayed images. This tutorial uses A simple php tutorial image upload class.


##Picture upload

Picture upload is also submitted through our <form>, but the difference is that we upload pictures File

  • Our form tag must add the enctype attribute with the value multipart/form-data, which is used to allow the form to upload binary data

  • Must Use the input form item, type is file, and the name is arbitrary

  • But you must remember that on the server side, we will use this name to get the file. The server side uses $_FILES to get the form. File


<form id="form1" name="upload" enctype="multipart/form-data" method="post" action="upload .php">
<input type="hidden" name="max_file_size " />
<input type="file" name="file" />
<input type ="submit" name="submit" value="Submit" />
</form>


##

Continuing Learning
||
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>
</h1>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
submitReset Code
图片放大关闭