This article is also written to their own view, because the writing is very concise, even the judgment is not, just directly realize the function can be uploaded.
Front desk:
<form action= "upload.php" method= "POST" enctype= "Multipart/form-data" >
<input type= "File" name= "MyFile"/>
<input type= "Submit" value= "Upload"/>
</form>
Background:
$name = $_files[' myfile ' [' Name '];//gets the path file name, the original name of the client machine file
$type = $_files[' myfile ' [' type '];//gets the file format, the MIME type of the file, which requires the browser to provide support for that information, such as "Image/gif"
$size = $_files[' myfile ' [' Size '];//gets the file size, the size of the uploaded file, in bytes
$tmp = $_files[' myfile ' [' tmp_name '];//file is uploaded and stored on the server after the temporary file name
$error =$_files[' myfile ' [' Error '];//and the file upload related error code
$uploads _dir= ' uploaded ';//Get the folder address where you want to store the picture
$rs =move_uploaded_file ($tmp, "$uploads _dir/$name");//upload pictures to the server
PHP form images uploaded to the server