title: can't upload file with Codeigniter
body: <p>i have a form that works perfectly - but it doesn't pass the file to the controller</p>
  
  <pre><code>&lt;?php
      $this-&gt;load-&gt;helper('form');
  
      //open form
          $attributes = array('class' =&gt; 'contact_form');
          echo form_open_multipart('admin/add_record', $attributes);
          echo form_hidden('current_area', $current_area);
  
          echo form_fieldset('Dati da inserire', array('class' =&gt; 'form_fieldset'));
              echo "&lt;p&gt;";
              echo form_label('Titolo:', 'title', array('class' =&gt; 'form_label'));
                  echo form_input('title', '', "class='form_textfield'");
              echo "&lt;/p&gt;";
          echo form_fieldset_close();
  
          echo form_fieldset('Immagine', array('class' =&gt; 'form_fieldset'));
              echo '&lt;p&gt;';
                  echo form_label('Immagine:', 'image', array('class' =&gt; 'form_label'));
                      echo form_upload('image', '', "class='form_filefield'");
              echo '&lt;/p&gt;';
          echo form_fieldset_close(); 
  
          echo form_fieldset('Testo', array('class' =&gt; 'form_fieldset'));
              echo form_label('', 'description', array('class' =&gt; 'form_label'));
                  echo form_textarea('description', '', array('class' =&gt; 'form_textarea', 'cols'  =&gt; 45, 'rows'  =&gt; 10));
          echo form_fieldset_close();
  
              //display submit button
              echo "&lt;p&gt;";
                  echo form_submit(array('class' =&gt; 'form_submit', 'name' =&gt; 'submit'), "Inserisci!");
              echo "&lt;/p&gt;";
  
          echo form_close();
  
  ?&gt;
  </code></pre>
  
  <p>if i dump $_POST variables at the receiving end, i see all of them EXCLUDING the file (variable named image above).</p>
  
  <p>the thing is, if I change </p>
  
  <pre><code>echo form_upload('image', '', "class='form_filefield'");
  </code></pre>
  
  <p>to</p>
  
  <pre><code>echo form_input('image', '', "class='form_filefield'");
  </code></pre>
  
  <p>it works, and the 'image' variable gets dumped like any other.</p>
  
  <p>Any ideas? </p>
  
  <p>thanks,
  Patrick </p>
  
  <p>EDIT:</p>
  
  <p>it seems some sort of a bug, as I've simplified the form and the controller and it still doesn't work:</p>
  
  <p>VIEW:</p>
  
  <pre><code>&lt;?php $this-&gt;load-&gt;helper('form', 'url'); ?&gt;
  
  &lt;?php echo form_open_multipart('admin/add_record2');
  
  echo form_upload('userfile', 'userfile');
  ?&gt;
  
  
  
  &lt;br /&gt;&lt;br /&gt;
  
  &lt;input type="submit" value="upload" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>CONTROLLER:</p>
  
  <pre><code>function add_record2()
  {
      //prints content of entire POST variable
  echo '&lt;pre&gt;'; print_r($_POST);echo '&lt;/pre&gt;';
  }
  </code></pre>
  
  <p>OUTPUT: an empty array...</p>
  
  <pre><code>Array
  (
  )
  </code></pre>
  
  <p>NEW EDIT
  I've managed to get it to work. Two things were needed:
  a) set the destination directory's permissions to 777
  b) type the destination directory in UNIX format (i'm on a local machine, so /users/patrick/sites/....../uploads  instead of localhost/site/img/uploads. I'm still not sure why this, and i need to remember to change this when i upload the site to webhost..</p>