title: Drupal 7 forms API: File upload
body: <p>I've been following the form example 10 from the Drupal doc:
  <a href="http://api.drupal.org/api/examples/form_example!form_example.module/group/form_example/7" rel="nofollow">http://api.drupal.org/api/examples/form_example!form_example.module/group/form_example/7</a></p>
  
  <p>Here goes the definition of my form:</p>
  
  <pre><code>function portal_upload_form($form, $form_state) {
  
      $form['file'] = array(
          '#type' =&gt; 'file',
          '#title' =&gt; t('Choose a file'),
      );
  
      $form['document_submit_button'] = array(
  
        '#type' =&gt; 'submit', 
        '#value' =&gt; t('upload'), 
      );
  
      return $form;
  }
  </code></pre>
  
  <p>And the form_submit hook:</p>
  
  <pre><code>function portal_upload_form_submit($form, &amp;$form_state) {
  
      $file = $form_state['values']['file'];
          // ...
  </code></pre>
  
  <p>$file is 'empty' despite having set an input file with 777 permissions. I'm missing something and can't find what on my own...</p>
  
  <p>Thanks!
  J.</p>