As long as the file upload tag in the form is named in the form of an array, multiple files can be uploaded simultaneously.
Let’s look at an example: -------------------------------------------------- -------------------
-------------------------------------------------- ---------------------------------------- The code execution results are as follows: Note: 1. In , name="upload_file[]" must be named in the form of an array, otherwise an error will occur: "Uninitialized string offset: 0", which means that your array key value is out of bounds 2. In $_FILES['upload_file']['name'][$i], upload_file is the name of the upload file marker in the form. When uploading multiple files, the third dimension subscript of the array $_FILES will automatically start from 0 Numbered in sequence. |