Se venligst, du kan få alle ideer om flere uploadhttp:// php.net/manual/en/features.file-upload.multiple.php
Se nedenstående eksempel
<?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 er nedenfor
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
)
)
)
For dit spørgsmål følger er foreach
<?php
foreach ($_FILES['userfile'] as $position => $file){
print_r($file);
}
?>
Når resultat for det se nedenfor:
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 forstå
Tak Pratik