I am trying to add multiple image upload in a codeigniter. What i have achieved so far that i can save one image in my database.But i want to add multiple image in single input.How can i do that?? Thanx in advance :) This is my controller:
public function customer_insert() {
$oidVal = implode(",", $this->input->post('multiselect'));
$config['upload_path'] = 'images/';
$config['allowed_types'] = 'gif|jpg|png|tif|docx|doc|pdf';
$config['max_size'] = '100000';
$config['max_width'] = '30000';
$config['max_height'] = '30000';
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload()) {
$fata = array('upload_data' => $this->upload->data());
$path = 'images/' . $fata['upload_data']['orig_name'];
}
$data = array(
'prof_image' => $path
);
$this->db->insert('customer', $data);
}
My view file:
<?php echo form_open_multipart('main/customer_insert');?>
<?php
$picture=array(
'type'=>'file',
'class'=>'form-control',
'name'=>"userfile",
);
$submit=array(
'name'=>'submit',
'type'=>'submit',
'class'=>'btn btn-primary btn-o pull-right next-step btn-wide',
'value'=>'Save',
)
?>
<div class="form-group">
<label class="control-label">
Cutomer Image <span class="symbol required"></span>
</label>
<?php echo form_upload($picture);?>
</div>