Ta en titt så kan du få all idé om flera uppladdningarhttp:// php.net/manual/en/features.file-upload.multiple.php
Se nedanstående exempel
<?php
print_r($_FILES);
?>
<form action="" method="post" enctype="multipart/form-data">
Send these files:<br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input type="submit" value="Send files" />
</form>
Se resultatet är nedan
Array
(
[userfile] => Array
(
[name] => Array
(
[0] => cancelled booking - PAYG.png
[1] => cancelled booking - PAYG.png
)
[type] => Array
(
[0] => image/png
[1] => image/png
)
[tmp_name] => Array
(
[0] => C:\xampp\tmp\php402A.tmp
[1] => C:\xampp\tmp\php402B.tmp
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 99134
[1] => 99134
)
)
)
För din fråga som följer är foreach
<?php
foreach ($_FILES['userfile'] as $position => $file){
print_r($file);
}
?>
När resultat för det se nedan:
Array
(
[0] => cancelled booking - PAYG.png
[1] => cancelled booking - PAYG.png
)
Array
(
[0] => image/png
[1] => image/png
)
Array
(
[0] => C:\xampp\tmp\php284D.tmp
[1] => C:\xampp\tmp\php284E.tmp
)
Array
(
[0] => 0
[1] => 0
)
Array
(
[0] => 99134
[1] => 99134
)
Så nu kan du förstå
Tack Pratik