Welcome Guest, Not a member yet? Register   Sign In
How to upload files with multiple incremented/numbered fields?
#1

[eluser]Ludovic-r[/eluser]
I want to upload files with CodeIgniter through generated numbered upload fields :

Code:
<input type='file' name='field[0]' />
<input type='file' name='field[1]' />

These upload fields are among another inputs fields :

Code:
<input type='file' name='field[0]' />
<input type='TEXT' name='field[1]' />
<input type='file' name='field[2]' />

I just want to upload the files when the user click on the Submit button and keep this specific inputs structure

I've tried this but it doesn't work :

Code:
for($i=0; $i<count($_FILES); $i++)
     {

       $config['upload_path']   = './uploads/';
       $config['allowed_types'] = 'jpg|jpeg|gif|png';
       $config['overwrite']     = FALSE;

      $this->upload->initialize($config);
$this->upload->do_upload('field['.$i.']');


     }

Any help would be very appreciated! Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB