title: Can't upload files in certain format - Codeigniter 3
body: <p>I created an upload form in code-igniter 3 with different directory. At first, I created upload form in format excel and PDF in each file input. But later, my boss asked me to add image/jpeg in upload form. I thought just add jpg in allowed types and add some max_size in controller will do. But files not saved in database or folder path, it only save excel and PDF format,i tried to change the user-file but no avail. No error showing so I kinda confused now. I hope you can help me with this, since i'm still learning Code-igniter.</p>
  
  <p>Controller:</p>
  
  <pre><code>public function file_data() {        
      $this-&gt;load-&gt;view('templates/header');
  
      $data['program'] = $this-&gt;input-&gt;post('program');
  
      $this-&gt;load-&gt;library('form_validation');        
      $this-&gt;form_validation-&gt;set_rules('program', 'Program', 'trim|required');       
      $this-&gt;form_validation-&gt;set_rules('file_nilai', 'File Nilai', 'required');
      $this-&gt;form_validation-&gt;set_rules('file_absen', 'File Kehadiran', 'required');
  
      //$this-&gt;load-&gt;library('upload');
  
      $config['upload_path'] = './uploaded_files/laporan/absen';
      $config['allowed_types'] = 'jpg|jpeg|pdf';
      $config['max_size'] = '2048';
  
      $this-&gt;load-&gt;library('upload');
      $this-&gt;upload-&gt;initialize($config);
      if (!$this-&gt;upload-&gt;do_upload('file_absen')) {      
          $this-&gt;session-&gt;set_flashdata('file_error', 'File type tidak sesuai.');
          $this-&gt;load-&gt;view('guru/upload_form', $data);
  
      } else {
          $upload_data_absen = $this-&gt;upload-&gt;data();
          unset($config);
  
          $config['upload_path'] = './uploaded_files/laporan/nilai';
          $config['allowed_types'] = 'xls|xlsx|pdf|jpg|jpeg';
          $config['overwrite'] = FALSE;
          $config['max_size'] = '2048';
  
          $this-&gt;load-&gt;library('upload');
          $this-&gt;upload-&gt;initialize($config);
          if (!$this-&gt;upload-&gt;do_upload('file_nilai')) {              
              $this-&gt;session-&gt;set_flashdata('file_error', 'File type tidak sesuai.');
              $this-&gt;load-&gt;view('guru/upload_form', $data);   
          } else {
              $upload_data_nilai = $this-&gt;upload-&gt;data();
  
              //get the uploaded file name
              $data['file_absen'] = $upload_data_absen['file_name'];
              $data['file_nilai'] = $upload_data_nilai['file_name'];
  
  
              //store files data to the db
              $this-&gt;laporan_model-&gt;simpan_data($data);
  
              $this-&gt;session-&gt;set_flashdata('file_success', 'Upload File Berhasil!');
              redirect(base_url() . "guru/laporan_np");
  
          }
      }
      $this-&gt;load-&gt;view('templates/footer');
  }
  </code></pre>
  
  <p>Model : </p>
  
  <pre><code>function simpan_data($data){        
      $data_user=$this-&gt;session-&gt;userdata('username');
      $insert_data['guru']    = $data_user;       
      $insert_data['program']    = $data['program'];       
      $insert_data['file_nilai'] = $data['file_nilai'];
      $insert_data['file_absen']   = $data['file_absen'];             
  
      $query = $this-&gt;db-&gt;insert('berkas', $insert_data);
  }
  </code></pre>
  
  <p>View : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;?php echo form_open_multipart('guru/laporan_np/file_data');?&gt;
      &lt;div class="form-group"&gt;
   &lt;label for="file_nilai"&gt;File Nilai &lt;span style="color:#FF0000"&gt;*&lt;/span&gt;:&lt;/label&gt;
   &lt;input type="file" name="file_nilai" class="form-control"  id="file_nilai" required&gt; 
   &lt;span&gt;&lt;p&gt;Allowed file types: &lt;strong&gt;xls, xlsx, jpeg, jpg&lt;/strong&gt;&lt;/p&gt;&lt;/span&gt;
   &lt;?php if ($this-&gt;session-&gt;flashdata('file_error')) { ?&gt;
    &lt;div class="alert alert-danger alert-dismissible" style="width:20%"&gt;&lt;button type="button" class="close" data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt; &lt;?= $this-&gt;session-&gt;flashdata('file_error') ?&gt; &lt;/div&gt;
   &lt;?php } ?&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;      
   &lt;label for="file_absen"&gt;File Kehadiran &lt;span style="color:#FF0000"&gt;*&lt;/span&gt;:&lt;/label&gt;
   &lt;input type="file" name="file_absen" class="form-control"  id="file_absen" required&gt; 
   &lt;span&gt;&lt;p&gt;Allowed file types: &lt;strong&gt;pdf, jpeg, jpg&lt;/strong&gt;&lt;/p&gt;&lt;/span&gt;
   &lt;?php if ($this-&gt;session-&gt;flashdata('file_error')) { ?&gt;
    &lt;div class="alert alert-danger alert-dismissible" style="width:20%"&gt;&lt;button type="button" class="close" data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;&lt;?= $this-&gt;session-&gt;flashdata('file_error') ?&gt; &lt;/div&gt;
   &lt;?php } ?&gt;
    &lt;/div&gt; 
    &lt;a href="&lt;?=base_url(). 'guru/laporan_np';?&gt;" class="btn btn-warning"&gt;&lt;span class="fa fa-arrow-left"&gt;&lt;/span&gt;&amp;nbsp;Back&lt;/a&gt;
    &lt;button type="submit" class="btn btn-success"&gt;&lt;span class="fa fa-save"&gt;&lt;/span&gt;&amp;nbsp;Submit&lt;/button&gt;
  &lt;/form&gt;
  &lt;?php echo form_close(); ?&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>