First, let's introduce the multiple property of file in HTML5
Definitions and usage
The multiple property stipulates that the input field can select multiple values. If this property is used, the field can accept multiple values.
Instance:
<form action= "demo_form.asp" method= "get" >
Select Images: <input type= "file" Name= "img" multiple= " Multiple "/>
<input type=" Submit "/>
</form>
The input file in the above instance can accept multiple file upload fields.
Understanding the multiple attribute of the file in HTML5, we begin by explaining how to use HTML5 to implement multiple file uploads.
Instance code:
Html:
PHP Code:
For ($i =0 $i <count ($_files[' upload '] [' name ']) $i + +) {
//get the temp file path
$tmpFilePath = $_files[' Upload ' [' tmp_name '] [$i];
Make sure we have a filepath
if ($tmpFilePath!= "") {
//setup our new file path
$newFilePath = "./uploadfile s/". $_files[' upload ' [' name '] [$i];
Upload the "file into" temp dir
if (Move_uploaded_file ($tmpFilePath, $newFilePath)) {
//handle other code her E
}
}
}
Thank you for reading, I hope to help you, thank you for your support for this site!