im having a page that will insert username, ID and the user must be able to upload upto 10 images .
The main problem that im having is when it comes to uploading multiple images using codeigniter.
can someone suggest me how can i pass each image path of each individual image to the array so i can pass it to the database.
-
and if the user selects to upload less than 10 images, like 2 or 5 then how can i ignore the error that says a file hasn't been selected and jst pass only the images that has been uploaded.
<form method="post" action="uploader/go" enctype="multipart/form-data"> <input name="username" type="text" /><br /> <input name="nid" type="text" /><br /> <input type="file" name="image1" /><br /> <input type="file" name="image2" /><br /> <input type="file" name="image3" /><br /> <input type="file" name="image4" /><br /> <input type="file" name="image5" /><br /> <input type="file" name="image6" /><br /> <input type="file" name="image7" /><br /> <input type="file" name="image8" /><br /> <input type="file" name="image9" /><br /> <input type="file" name="image10" /><br /> <input type="submit" name="go" value="Upload!!!" /> </form>
sample controller
$image_data=array('image_info' => $this->upload->data('image'));
$image_path=$image_data['image_info']['full_path'];
$data =array(
'id'=>uniqid('id_'),
'nID'=>$this->input->post('nid'),
'username'=>$username,
'image1'=>$image_path
}
any help will be appreciated.