title: Codeigniter Upload File not working
body: <pre><code>function submit_article() {
      $this-&gt;load-&gt;helper(array('form', 'url'));
      $this-&gt;load-&gt;library('form_validation');
      $this-&gt;form_validation-&gt;set_error_delimiters('&lt;p style="color:red"&gt;', '&lt;br/&gt;&lt;/p&gt;');
  
      $my_rules = array(
          array(
              'field' =&gt; 'title',
              'label' =&gt; 'Title',
              'rules' =&gt; 'required|min_length[5]|max_length[20]|xss_clean'
          ),
          array(
              'field' =&gt; 'additionalUpload',
              'label' =&gt; 'Additional Upload',
              'rules' =&gt; 'callback_is_image'
          )
      );
  
      $this-&gt;form_validation-&gt;set_rules($my_rules);
  
      if ($this-&gt;form_validation-&gt;run() == FALSE) {
          //ERROR
          $data['title'] = ucfirst('submit Article');
          $this-&gt;load-&gt;view('templates/header', $data);
          $this-&gt;load-&gt;view('submit_article', $data);
          $this-&gt;load-&gt;view('templates/footer', $data);
      } else {
          //SUCCESS
          $data['title'] = ucfirst('article Submitted');
          $this-&gt;load-&gt;view('templates/header', $data);
          $this-&gt;load-&gt;view('forms_view/submit_article_success', $data);
          $this-&gt;load-&gt;view('templates/footer', $data);
      }
  }
  
  function is_image($value) {
  
      $config['upload_path'] = './public/uploads/';
      $config['allowed_types'] = 'gif|jpg|png|pdf|tiff';
      $config['max_size'] = '2048';
      $config['max_width'] = '0';
      $config['max_height'] = '0';
      $config['remove_spaces'] = true;
  
      $this-&gt;load-&gt;library('upload', $config);
  
      if (!$this-&gt;upload-&gt;do_upload()) {
          $this-&gt;form_validation-&gt;set_message('is_image', $this-&gt;upload-&gt;display_errors('&lt;p style="color:red"&gt;', '&lt;br/&gt;&lt;/p&gt;'));
          return FALSE;
      } else {
          $this-&gt;upload-&gt;data();
          return TRUE;
      }
  }
  </code></pre>
  
  <p>Hi every one, this is my controller function code for processing multipart form data in codeigniter, actually the field additionalUpload is not a required feild, but I want it to be validated if the user upload file in additionalUpload field of file type, when I run the above code and click on submit button without selecting any file its shows me error "You did not select a file to upload." which I do not want because this is not a required field, this is my first problem..</p>
  
  <p>and second one is that when I select a file and click on submit button it again show me that "You did not select a file to upload.". </p>
  
  <p>Note: I have just shown two fields of my form here that is title,additionalUpload but I have all total 9 fields.</p>
  
  <p>THANKS IN ADVANCE PLEASE HELP ANYONE.</p>