title: CodeIgniter - Verify form with fields and file upload
body: <p>Maybe I am missing something simple, but I can't seem to get my form verification just right.</p>
  
  <p>How can I get the form validation to check the file verification too without doing an </p>
  
  <pre><code>$this-&gt;upload-&gt;do_upload("fldImage")
  </code></pre>
  
  <p>this is my verification process currently:</p>
  
  <pre><code>if ($this-&gt;form_validation-&gt;run() == FALSE)
      {
          if ( ! $this-&gt;upload-&gt;display_errors("fldImage"))
          {
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
          }
          $this-&gt;load-&gt;view('submitBlog', $error);
      }
      else
      {
          if ( ! $this-&gt;upload-&gt;do_upload("fldImage"))
          {
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
              $this-&gt;load-&gt;view('submitBlog', $error);
          }
          else
          {
              $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
              unset($blog['submit']);
              $imagePath = "uploads/".$data['upload_data']['file_name'];
              $blog['fldImage'] = $imagePath;
              $blog['fldDateAdded'] = $datetime;
              $this-&gt;db-&gt;insert('tblBlog', $blog); 
              $this-&gt;load-&gt;view('submitBlogSuccess', $data);
          }
      }
  </code></pre>
  
  <p>but of course I can't call </p>
  
  <pre><code>do_upload("fldImage")
  </code></pre>
  
  <p>without running</p>
  
  <pre><code>do_upload()
  </code></pre>
  
  <p>but if the image is valid but the other form values are not, I do not want to upload the image.  </p>