title: PHP: How to get File Name & Extension of uploaded file in Codeigniter?
body: <p>i need to store only filename + extension of file when upload and rename done to my databse.my problem is can't get extension.</p>
  
  <pre><code>    $new_file_name=date("mdY")."_".time();
      $config['upload_path']          = './assets/images/';
      $config['allowed_types']        = 'gif|jpg|png';
      $config['max_size']             = 2048;
      $config['max_width']            = 1024;
      $config['max_height']           = 768;
      $config['file_name']            = $new_file_name;
  
      $this-&gt;load-&gt;library('upload', $config);
  
      if ( ! $this-&gt;upload-&gt;do_upload('uploadFile'))
      {
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
              var_dump($error);
      }
      else
      {
              $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
              var_dump($data);
              echo $config['file_name'] . $config['file_ext'];
  
      }
  </code></pre>
  
  <p>my next question load helper form for ? or need load form to use library form_validation ?</p>
  
  <pre><code>$this-&gt;load-&gt;helper(array('form')); for ?
  
  $this-&gt;load-&gt;library('form_validation'); this for validation rule 
  </code></pre>