Actually trying to upload multiple pictures in a folder at once with some kind of renaming. The upload goes to the foreach loop. However, it does stop at this point:
foreach ($_FILES['pictures']['name'] as $f => $name) {
if ($_FILES['pictures']['error'][$f] == 0) {
$name = $date;
$name .= "-";
$name .= $i;
$name .= ".";
$extsearch = $_FILES['pictures']['name'][$f];
$ext = pathinfo($extsearch, PATHINFO_EXTENSION);
$name .= $ext;
if(move_uploaded_file($_FILES["pictures"]["tmp_name"][$f], $path.$name)) {
if ($i == 1) {
create_image_thumb($albumFolder, $name);
}
$i++;
resize_image($albumFolder, $name);
}
}
}
However, I receive this error in the error_log and the files aren't moved:
PHP Warning: Invalid argument supplied for foreach() in /home/clublabo/public_html/management/create_album_action.php on line 43
UPDATE: Here is the HTML Code:
<form class="form form-horizontal" action="create_album_action.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="email-2" class="col-sm-3 col-md-4 control-label">Date</label>
<div class="col-sm-6 col-md-4">
<div class="input-with-icon">
<input name="dateAlbum" class="form-control" type="text" value="<?php echo date('Y-m-d'); ?>" data-provide="datepicker" data-date-autoclose="true" data-date-format="yyyy-mm-dd"><span class="icon icon-calendar input-icon"></span></div>
</div>
</div>
<div class="form-group">
<label for="password-2" class="col-sm-3 col-md-4 control-label">Pictures</label>
<div class="col-sm-6 col-md-4">
<input name="pictures" id="password-2" class="form-control" type="file" multiple>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6 col-md-offset-4 col-md-4">
<button class="btn btn-primary pull-right" type="submit">Create Album</button>
</div>
</div>
</form>
Maybe you guys has any Idea how to have this resolved?
Thanks :)