title: Rename multiple file upload codeigniter
body: <p>I want to rename all files during uploading process. I'm uploading 3 files at single time. My frontend code is </p>
  
  <pre><code>&lt;form&gt;
  &lt;input type="file" class="form-control" name="photo_1"&gt;
  &lt;input type="file" class="form-control" name="pan_1"&gt;
  &lt;input type="file" class="form-control" name="add_1"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My code in controller is as following</p>
  
  <pre><code>function upload(){
      $this-&gt;upload_file('photo_1');
       $this-&gt;upload_file('pan_1');
       $this-&gt;upload_file('add_1');
  }
  function upload_file($field_name)
      {
  
          //$ext = substr( strrchr($_FILES[$field_name]['name'], '.'), 1);
          //$new_name = $types.'_'.$numb.'_dev_.'.$ext;
          $config['file_name']            = $_FILES[$field_name]['name'];
          $config['upload_path']          = './uploads/';
          $config['allowed_types']        = 'jpeg|jpg|png';
         // $config['max_size']             = 100;
  
          $this-&gt;load-&gt;library('upload', $config);
  
          if ( ! $this-&gt;upload-&gt;do_upload($field_name))
          {
              return array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
          }
          else
          {
              $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
          }
      }
  </code></pre>
  
  <p>But I' getting same name for each file with increment. <strong>Like photo_1, photo_11, photo_12</strong>. I want file name like <strong>photo_sometext_1</strong></p>
  
  <p>any help will be appreciated</p>