title: How to insert filename in database using codeigniter upload lib
body: <p>It's ok to upload image in file using codeigniter upload library with this example.</p>
  
  <p>However, I want to send filename in database. Can anybody pls give me example ? Thanks</p>
  
  <pre><code>&lt;?php
  
  class Upload extends Controller {
  
  function Upload()
  {
      parent::Controller();
      $this-&gt;load-&gt;helper(array('form', 'url'));
  }
  
  function index()
  {   
      $this-&gt;load-&gt;view('upload_form', array('error' =&gt; ' ' ));
  }
  
  function do_upload()
  {
      $config['upload_path'] = './uploads/';
      $config['allowed_types'] = 'gif|jpg|png';
      $config['max_size'] = '100';
      $config['max_width']  = '1024';
      $config['max_height']  = '768';
  
      $this-&gt;load-&gt;library('upload', $config);
  
      if ( ! $this-&gt;upload-&gt;do_upload())
      {
          $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
          $this-&gt;load-&gt;view('upload_form', $error);
      }   
      else
      {
          $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
          $this-&gt;load-&gt;view('upload_success', $data);
      }
  }   
  }
  ?&gt;
  </code></pre>
  
  <p>Or do we have any alternative?</p>