1
2 <form action="file-upload.html" method="post" enctype="multipart/form-data">
3 Send these files:<br>
4 <input name="userfile[]" type="file"><br>
5 <input name="userfile[]" type="file"><br>
6 <input type="submit" value="Send files">
7 </form>
8
When the above form is submitted, the arrays $userfile, $userfile_name, and $userfile_size will be formed in the global scope (as well as in $HTTP_POST_VARS). Each of these will be a numerically indexed array of the appropriate values for the submitted files.
For instance, assume that the filenames /home/test/review.html and /home/test/xwp.out are submitted. In this case, $userfile_name[0] would contain the value review.html, and $userfile_name[1] would contain the value xwp.out. Similarly, $userfile_size[0] would contain review.html's filesize, and so forth.
I use this method to upload files to server and I want to index userfile[0] to particular directory and userfile[1] to other. Meanwhile, userfile[0] could be empty.
However, once I put the index number into [],
the whole process is not working.
<input name="userfile[0]" type="file">
<input name="userfile[1]" type="file">
to specify particular file, let say userfile[0] is for particular group which also userfile[0] could be empty.
Why and how to fix it ?