title: Why is the upload path not valid? (Codeigniter)
body: <p>I have a controller with the method 'do_upload' which should upload an image to /img but instead I'm getting the following error: </p>
  
  <pre><code>http://localhost/img/
  </code></pre>
  
  <p>The upload path does not appear to be valid.</p>
  
  <p>This is the method of the upload class. </p>
  
  <pre><code>public function do_upload(){
  
          $config['upload_path']= "http://localhost/img/";
          $config['allowed_types']= 'gif|jpg|png';
          $config['max_size']='100';
          $config['max_width']='1024';
          $config['max_height']='768';
  
  
          $this-&gt;load-&gt;library('upload',$config);
  
          if(!$this-&gt;upload-&gt;do_upload()){
              $errors=array('errors'=&gt;$this-&gt;upload-&gt;display_errors());
              echo $config['upload_path'];
              $this-&gt;load-&gt;view('error',$errors);
          }
  
          else{
  
              $data=array('upload_data'=&gt; $this-&gt;upload-&gt;data());
  
              $this-&gt;load-&gt;view('admin/admin');
          }
      }
  </code></pre>
  
  <p>The file permissions are set to the following (to test this works!):</p>
  
  <p>drwxrwxrwx </p>
  
  <p>However, if I direct my browser to <code>http://localhost/img/</code> I am able to view the contents of the directory so I don't think it's a permission issue. Is there something I'm doing wrong? </p>