I have made a code that let me upload multiple files but in separate 

I was trying to upload a multiple files in one input where i set my input tag into

```
<input type="file" multiple="" name="file1">

```

I selected 3 images but only 1 image was uploaded..

here is my VIEW before changing my input:

```
<?php echo form_open_multipart('test'); ?>
<p>
    <?php echo form_label('File 1: ', 'file1') ?>
    <input type='file' name='file1' id='file1'>
</p>
<p>
    <?php //echo form_label('File 2: ', 'file2') ?>
    <input type='file' name='file2' id='file2'>
</p>
<p><?php echo form_submit('submit', 'Upload them files!') ?></p>

```

and here is my CONTROLLER

```
function index()
{
    if (isset($_POST['submit']))
    {
        $this->load->library('upload');

        $config['upload_path'] = './upload_documents/';
        $config['allowed_types'] = 'jpg|png|gif|jpeg|JPG|PNG|GIF|JPEG';
        $config['max_size'] = '0'; // 0 = no file size limit
        $config['max_width']  = '0';
        $config['max_height']  = '0';
        $config['overwrite'] = TRUE;

        $this->upload->initialize($config);

        foreach($_FILES as $field => $file)
        {
            // No problems with the file
            if($file['error'] == 0)
            {
                // So lets upload
                if ($this->upload->do_upload($field))
                {
                    $data = $this->upload->data();
                    //alert("nice");
                }
                else
                {
                    $errors = $this->upload->display_errors();
                    die();
                }
            }
            else{
                echo "alksjdfl";
                die();
            }
        }
    }
    $this->load->view("test");
    }
}

```