[eluser]Unknown[/eluser]
Code:
$config['upload_path'] = './property_image/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '2240';
$this->load->library('upload', $config);
for($i = 0;$i<=14;$i++){
$name = 'media_image_0'.$i;
if($i>9){
$name = 'media_image_'.$i;
} // end of if($i>9
if(isset($_FILES[$name])){
$this->upload->do_upload($name);
$idata = $this->upload->data();
dump($idata['file_name']);
}else{
// do nothing
}// end of if(!empty
} // end of for loop
This code above uploads multiple images but the problem is,
if I select only one image, (let's say, in the first field) all other fields get the same name. How can I stop it?
I know the problem too, it's $idata = $this->upload->data(); ... $idata needs to be different for every field.
But I'm not being able to make it work. Please help me. I need to get the name too.