I have used the form below to upload multiple images to my server.
<form name="addimageForm" id="addimageForm" method="post" action="" enctype="multipart/form-data">
Gallery Image:
<input name="image_name[]" type="file" id="image_name" multiple="true">
<input type="submit" name="addCatImage"/>
</form>
But I am confused how I should loop through it so that I can insert multiple images in my database. I used the code below, and when I run it, even when I select a image, 4 rows are inserted in my table. I think it is inserting all of the array fields(name, size, tmp_name). How can i solve the problem?
foreach ($_FILES[image_name] as $file) {
$access->uploadSubCatImages();
}