I am trying to upload multiple images in codeigniter.
The following code consists of a image uploader, it only allow me to upload one image as the details of other images are not detected.
How can I go about enabling it to allow upload of multiple images?
<?php echo form_open_multipart('backendProduct/product_image_upload?item_id='.$item_id);?>
<div class="input-group">
<?php echo "item id is: "; echo $item_id;?>
<?php echo form_upload(array('name'=>'userfile', 'class'=>'form-control'));?>
<span class="input-group-btn">
<button class="btn btn-primary" name="submit" type="submit"><i class="icon-upload"></i></button>
</span>
</div>
</form>
controller
foreach($post as $key=> $value)
{
//retrieve the $key that start with 'images_files'
if (0 === strpos($key, 'images_files'))
{
log_message('debug', '['.__CLASS__.']['.__FUNCTION__.']['.$key.']['.print_r($value,TRUE).']');
//$images_files = $value;
$images_files = $value[1];
echo $images_files;
}
elseif(0 === strpos($key, 'images_alt'))
{
log_message('debug', '['.__CLASS__.']['.__FUNCTION__.']['.$key.']['.print_r($value,TRUE).']');
$images_alt = $value;
}
elseif(0 === strpos($key, 'images_caption'))
{
log_message('debug', '['.__CLASS__.']['.__FUNCTION__.']['.$key.']['.print_r($value,TRUE).']');
$images_caption = $value;
/*array_push($images,
array(
,,$value)
);*/
}