Welcome Guest, Not a member yet? Register   Sign In
Uploading multiple images from posted array
#1

[eluser]Wonder Woman[/eluser]
Hi,

I want to loop through an array to upload images but I can't seem to access the array in my controller...how can i do it so I loop the script to upload...thanks in advance.

view:
Code:
<input type="file" name="userfile[]" id="userfile" class="multi" />

controller:
Code:
$config['upload_path'] = $this->config->item('upload_path');
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$this->load->library('upload', $config);
$this->upload->initialize($config);
  
if(!$this->upload->do_upload()) {
   $data['upload_error'] = array('error' => $this->upload->display_errors());
} else {
   $data['upload_success'] = array('upload_data' => $this->upload->data());
   $this->upload_model->upload_gallery($this->upload->file_name);
}
#2

[eluser]ludo31[/eluser]
Hi ;

try to adapt your code :

view :

http://pastie.org/3679320

controller :

http://pastie.org/3679335

and view success

http://pastie.org/3679342

don't forget to make lib->clear and $this->image_lib->initialize($config);




Theme © iAndrew 2016 - Forum software by © MyBB