The bulk upload method is also very simple we just add a name=\ "pictures[]\" array to the form, and then use the foreach ($_files[\ "pictures\"][\ "error\"] as $key = $error) The Move_uploaded_file ($tmp _name, $uploadfile) were used to determine the cyclic array. Implement the file upload is possible.
HTML code
| The code is as follows |
Copy Code |
Upload picture More once |
PHP Processing Code
| |
copy code |
| "!--? php If ($_post[' upload ']= = ' Send ') { $dest _folder = "picture/"; If (!file_exists ($dest _folder)) { mkdir ($dest _folder); } foreach ($_files["Pictures" ["Error"] as $key = = $error) { if ($error = = UPLOAD_ERR_OK) { $ Tmp_name = $_files["Pictures" ["Tmp_name"] [$key]; $name = $_files["Pictures" ["Name"] [$key]; $uploadfile = $dest _folder. $name; Move_uploaded_file ($tmp _name, $uploadfile); } } } ?> |
The method is quite simple we just changed the single file upload to a multi-file upload, the other only changed to two places one is the table sole name changed to PHP array form one is to upload the file place using foreach to log the group traversal.
http://www.bkjia.com/PHPjc/629142.html www.bkjia.com true http://www.bkjia.com/PHPjc/629142.html techarticle The bulk upload method is also very simple we just add a name=\ "pictures[]\" array to the form, and then use the foreach ($_files[\ "pictures\"][\ "error\"] as $key = $ Error) loop -over the array ...