title: Codeigniter upload image - The upload path does not appear to be valid
body: <p>I am having issues uploading an image using the codeigniter upload library, I keep getting the error, </p>
  
  <blockquote>
    <p>The upload path does not appear to be valid.</p>
  </blockquote>
  
  <p>The file path I am trying to upload too is as follows, </p>
  
  <p><code>$config['upload_path'] = './media/images/site';</code></p>
  
  <p>and when I dot the following, </p>
  
  <pre><code>die(var_dump(is_dir($config['upload_path'])));
  </code></pre>
  
  <p>I get the following returned, </p>
  
  <blockquote>
    <p>bool(true)</p>
  </blockquote>
  
  <p>The folder is also writable (777), so I am not sure where I am going wrong, below is my upload code, </p>
  
  <pre><code>$config['upload_path'] = './media/images/site';
          //die(realpath($config['upload_path']));
          //die(var_dump(is_dir($config['upload_path'])));  
          $config['allowed_types'] = 'gif|jpg|png|jpeg';
          $config['max_size'] = '1500';
          $config['max_width']  = '390';
          $config['max_height']  = '269';
  
          $this-&gt;load-&gt;library('upload',$config);
          if ( ! $this-&gt;upload-&gt;do_upload() &amp;&amp; $_FILES['userfile']['error'] != 4)
          {
              $data['error'] = $this-&gt;upload-&gt;display_errors();
              $this-&gt;template-&gt;build('/admin/pages/about_us', $data);
          }
          else
          {
              $image = $this-&gt;upload-&gt;data();
              if(empty($image['file_name'])) {
                  $image['file_name'] = $this-&gt;formbuilder-&gt;defaults['page_image'];
              }
              $page = array(
                  //'page_title' =&gt; $this-&gt;input-&gt;post('page_title'),
                  //'page_slug' =&gt; $this-&gt;input-&gt;post('page_slug'),
                  'page_content' =&gt; $this-&gt;input-&gt;post('page_content'),
                  'page_image' =&gt; $image['file_name'],
                  'date_created' =&gt; date("Y-m-d h:i:s"),
                  'created_by' =&gt; 1
              );
  
              if($this-&gt;pages_model-&gt;insert($this-&gt;security-&gt;xss_clean($page)))
              {
                  redirect('/admin/dashboard');
              }
          }
  </code></pre>
  
  <p>I cannot see anything glaringly obvious that would stop the file from being uploaded, below is my folder structure of my project</p>
  
  <pre><code>/application
  /system 
  index.php
  .htaccess
  /media
      /images
          /site
          /admin
      /css
      /js
  </code></pre>
  
  <p>If anyone can shed any light on my problem that would be great.</p>
  
  <p>EDIT FOR THE PETULENT DOWNVOTER</p>
  
  <p>What would be causing this problem?</p>
  
  <p>(There is a question, as if it wasn't obvious enough anyway)</p>