title: "The upload path does not appear to be valid" Codeigniter image upload
body: <p>This has been asked a lot but after trying a number of things, I still can't find a solution to my cause of this issue. </p>
  
  <p>I'm autoloading the upload library.</p>
  
  <p>My folder structure is:</p>
  
  <pre><code>/application/
  /assets/
      css/
      images/
          hero/
      js/
  /system/
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>$fileName = $this-&gt;input-&gt;post('title') . '_hero';
  $filePath = './assets/images/hero/';
  $config['allowed_types'] = 'gif|jpg|png';
  $config['overwrite'] = true;
  
  $this-&gt;upload-&gt;initialize($config);
  
  if (!empty($_FILES['heroimage'])) {
      $config['file_name'] = $fileName;
      $config['upload_path'] = $filePath;
  
      if (!$this-&gt;upload-&gt;do_upload('heroimage')) {
          $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);
      }
  }
  </code></pre>
  
  <p>I have tried initializing both how it is now and using <code>$this-&gt;load-&gt;library('upload', $config);</code> but neither have worked.</p>
  
  <p>I have also checked if the directory exists and if it is writable and both returned true.</p>
  
  <p>Another thing I tried was setting the upload path to <code>$config['upload_path'] = FCPATH.'assets\images\hero';</code></p>
  
  <p>Any help pointing me in the right direction would be appreciated.</p>