Reputation: 1501
PHP script
$count = 0;
foreach ($_FILES['filesToUpload'] as $file) {
//upload process
echo $file[$count]['tmp_name'].',';
$count ++;
}
HTML
<form method="POST" action="action-here" enctype="multipart/form-data">
<input class="btn" name="filesToUpload[]" type="file" multiple="" />
<input class="btn primary" type="submit" value="Submit">
</form>
I'm doing this majorly wrong. What i'm trying to do is make it so you select the files then the php script processes it like an array?
I keep getting out puts such as 1,i,C,,,
.
I know other ways to do multiple uploads, but I know this is one of the simplest.
Upvotes: 2
Views: 5749
Reputation: 16462
foreach ($_FILES['filesToUpload']['error'] as $k => $error) {
echo $_FILES['filesToUpload']['tmp_name'][$k].',';
}
Tips: debug it with print_r($_FILES)
.
Upvotes: 3