title: Url redirection problems uploading a file in Codeigniter 2.0.2
body: <p>I am trying to upload an image using Codeigniter, following the CI user guide - but I'm getting an error due to the url redirection.</p>
  
  <p>This is my view <code>upload_form.php</code>:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Upload Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;?php echo $error;?&gt;
  
  &lt;?php echo form_open_multipart('upload/do_upload');?&gt;
  
  &lt;input type="file" name="userfile" size="20" /&gt;
  
  &lt;br /&gt;&lt;br /&gt;
  
  &lt;input type="submit" value="upload" /&gt;
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>View 2 <code>upload_success.php</code>:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Upload Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;h3&gt;Your file was successfully uploaded!&lt;/h3&gt;
  
  &lt;ul&gt;
  &lt;?php foreach ($upload_data as $item =&gt; $value):?&gt;
  &lt;li&gt;&lt;?php echo $item;?&gt;: &lt;?php echo $value;?&gt;&lt;/li&gt;
  &lt;?php endforeach; ?&gt;
  &lt;/ul&gt;
  
  &lt;p&gt;&lt;?php echo anchor('upload', 'Upload Another File!'); ?&gt;&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Controller <code>upload.php</code>:</p>
  
  <pre><code>&lt;?php
  
  class Upload extends CI_Controller {
  
      function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;helper(array('form', 'url'));
      }
  
      function index()
      {
          $this-&gt;load-&gt;view('upload_form', array('error' =&gt; ' ' ));
      }
  
      function do_upload()
      {
  
          $config['upload_path'] = './uploads/';
          $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())
          {
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
              $this-&gt;load-&gt;view('upload_form', $error);
          }
          else
          {
              $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
              $this-&gt;load-&gt;view('upload_success', $data);
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>I added the folder "uploads" under the "project_name" folder.</p>
  
  <p>I am using this url for the upload form:</p>
  
  <blockquote>
    <p><code>localhost/project_name/index.php/upload/</code></p>
  </blockquote>
  
  <p>After submitting I get a "page not found" error and the url becomes:</p>
  
  <blockquote>
    <p><code>http://localhost/project_name/index.php/upload/localhost/project_name/index.php/upload/do_upload</code></p>
  </blockquote>