title: Codeigniter - Need help uploading picture to both folder and database
body: <p>I need help uploading the picture to the folder and database. It seems I can only send it to the database, but not upload it to the folder. Is there anything wrong with the code?</p>
  
  <p><strong>admin.php (controller)</strong></p>
  
  <pre><code>public function input_siswa(){
      $config['upload_path']          = './gambarfolder/';
      $config['allowed_types']        = 'gif|jpg|png';
      $config['max_size']             = '100';
      $config['max_width']            = '1024';
      $config['max_height']           = '768';
  
      $this-&gt;load-&gt;library('upload');
      $this-&gt;upload-&gt;initialize($config);
      $location=base_url().'/gambarfolder/';
      $pict=$location.$data_imge;
  
      $nama_siswa = $this-&gt;input-&gt;post('nama_siswa');
      $nis = $this-&gt;input-&gt;post('nis');
      $id_jurusan = $this-&gt;input-&gt;post('id_jurusan');
      $data = array(
              'nama_siswa'=&gt;$nama_siswa,
              'nis'=&gt;$nis,
              'id_jurusan'=&gt;$id_jurusan,
              'gambar'=&gt;$pict
                );
      $this-&gt;m_model-&gt;create('siswa',$data);   
      redirect(base_url('index.php/admin/tampil_siswa'));
  }
  </code></pre>