First of all, explain the implementation of the method.
To implement multiple file uploads, we can add multiple input file fields to the form form and then set the Name property of the input file to the same name and use the form of an array named, for example, filename[]. As for the file upload PHP code and a single file upload is the same reason.
Here's an example of a multi-file upload:
HTML file example.html
<! DOCTYPE html>
PHP file my_parser.php
<?phpif (Isset ($_files[' File_array ')) { $name _array = $_files[' File_array ' [' name ']; $tmp _name_array = $_files[' File_array ' [' tmp_name ']; $type _array = $_files[' File_array ' [' type ']; $size _array = $_files[' File_array ' [' size ']; $error _array = $_files[' File_array ' [' Error ']; for ($i = 0; $i < count ($tmp _name_array); $i + +) { if (move_uploaded_file ($tmp _name_array[$i], "test_uploads/". $ name_array[$i]) { echo $name _array[$i]. "Upload is complete<br>"; } else { echo "move_uploaded_file Function failed for ". $name _array[$i]." <br> "; }} }? >
Thank you for reading, hope to help everyone, thank you for the support of this site!
More PHP Multi-file Upload implementation Examples related articles please pay attention to topic.alibabacloud.com!