title: insert multiple images in database using codeigniter and filepond
body: <p>Following is my controller In this I am using two if statements one for multiple images and another is for the featured image.. my <strong>images are uploaded in a folder very well</strong> but <strong>multiple names are not inserted in the database</strong>...Only one file name is inserted in the database... </p>
  
  <pre><code> public function uploadApi()
  {
  
      if (isset($_FILES['userfile'])) {
          $config['upload_path']          = 'uploads/';
          $config['allowed_types']        = 'gif|jpg|png';
          $config['max_size']             = 200000;
          $config['max_width']            = 2024;
          $config['max_height']           = 1768;
  
          $this-&gt;upload-&gt;initialize($config);        
          $this-&gt;load-&gt;library('upload', $config);
          $this-&gt;upload-&gt;do_upload('userfile');
          $data = array( $this-&gt;upload-&gt;data()); 
          $this-&gt;m-&gt;update_post($data[0]['file_name']);   
  
      }
      if(isset($_FILES['userfile1'])) {
         $config['upload_path']          = 'uploads/';
         $config['allowed_types']        = 'gif|jpg|png';
         $config['max_size']             = 200000;
         $config['max_width']            = 2024;
         $config['max_height']           = 1768;
  
         $this-&gt;upload-&gt;initialize($config);        
         $this-&gt;load-&gt;library('upload', $config);
         $this-&gt;upload-&gt;do_upload('userfile1');
         $data = array( $this-&gt;upload-&gt;data());     
         $this-&gt;m-&gt;update_feature($data[0]['file_name']);   
  
     }
  }
  </code></pre>
  
  <p><strong>This is a model ..</strong></p>
  
  <pre><code>            #-Update images Post-#
   public function update_post($picture) {
  $post = array(
      'post_images'=&gt;$picture,
  );  
  $this-&gt;db
  -&gt;where('post_status','draft')
  -&gt;update('post',$post); 
  return true; 
       }
  
  public function update_feature($picture) {
  $post = array(
      'post_featured_image'=&gt;$picture,
  );  
  $this-&gt;db
          // -&gt;set('post_created', 'NOW()', FALSE)
  
  -&gt;where('post_status','draft')
  -&gt;update('post',$post);
  return true; 
  }
  </code></pre>
  
  <p><strong>filepond plugin script</strong>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>     FilePond.registerPlugin(
          FilePondPluginFileValidateSize,
          FilePondPluginImageExifOrientation,
          FilePondPluginImageCrop,
          FilePondPluginImageResize,
          FilePondPluginImagePreview,
          FilePondPluginImageTransform
          );    
      // Set default FilePond options
      FilePond.setOptions({
          // maximum allowed file size
          maxFileSize: '50MB',
          imagePreviewHeight: 100,
          imagePreviewWidth: 200,
          instantUpload: true,
          // crop the image to a 1:1 ratio
          imageCropAspectRatio: '1:1',
          // upload to this server end point
          server: {
              url: '&lt;?php echo base_url() ?&gt;Admin/uploadApi',
          }        
      });
     
      var pond = FilePond.create(document.querySelector('input[name="userfile"]'));
      var pond = FilePond.create(document.querySelector('input[name="userfile1"]'));
     </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>**This is a view ..**
  
    &lt;form method="post" enctype="multipart/form-data" class="toggle-disabled" action="&lt;?php echo base_url() ?&gt;Admin/update_post1" id='ritesh'&gt;
    
    &lt;div class="col-md-6"&gt;
                            &lt;div class="form-group"&gt;
                              &lt;label&gt;Upload images&lt;/label&gt;
                              &lt;input type="file" 
                              class="filepond"
                              name="userfile"
                              multiple
                              data-max-file-size="5MB"
                              data-max-files="50" data-validation="required extension" /&gt;   
  
                          &lt;/div&gt;
  
                          &lt;div class="form-group"&gt;
                              &lt;label&gt;Feature image&lt;/label&gt;
                              &lt;input type="file" 
                              class="filepond"
                              name="userfile1"                            
                              data-max-file-size="5MB"
                              data-validation="required extension"
                              /&gt;
                          &lt;/div&gt;
                          
                          &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>