Ec (2); PHP supports uploading multiple files at the same time and automatically organizing their information in an array. To complete this function, you need to use the same Array submit syntax for the file upload fields in the HTML form and the multi-choice box and the check box. & Nbsp; & lt; title & gt; upload multiple files & lt; title & gt; & lt; link & nbsp; rel & quot; stylesheet & quot; & nbsp; ty script ec (2); script
PHP supports uploading multiple files at the same time and automatically organizing their information in the form of arrays. To complete this function, you need to use the same Array submit syntax for the file upload fields in the HTML form and the multi-choice box and the check box.
Upload multiple files
After the preceding form is submitted, the array $ _ FILES ['userfile'], $ _ FILES ['userfile'] ['name'] and $ _ FILES ['userfile'] ['SIZE'] will be initialized ($ HTTP_POST_FILES before PHP 4.1.0). If register_globals is set to on, the global variables related to file upload will also be initialized. All the submitted information will be stored in an array indexed by numbers.
For example, assume the names are/home/test/review.html and/home/test/xwp. when an out file is submitted, the value of $ _ FILES ['userfile'] ['name'] [0] will be review.html, the value of $ _ FILES ['userfile'] ['name'] [1] is xwp. out. Similarly, $ _ FILES ['userfile'] ['SIZE'] [0] will contain the size of the file review.html, and so on.
In addition, $ _ FILES ['userfile'] ['name'] [0] is also set. $ _ FILES ['userfile'] ['tmp _ name'] [0], $ _ FILES ['userfile'] ['SIZE'] [0] and $ _ FILES ['userfile'] ['type'] [0].
PHP File
Upload_array.php
--------------------------------
For ($ I = 0; $ I {
If ($ userfile_name [$ I] <> "") // checks whether the uploaded file is empty.
{
Copy ($ userfile [$ I], $ userfile_name [$ I]);
Echo "file name:", $ userfile_name [$ I],"
";
Echo "file size:", $ userfile_size [$ I],"
";
Echo "file type:", $ userfile_type [$ I];
}
}
?>