File upload empty in custom form I have a really simple form with a file upload. It actually used to work until I recently noticed it's not saving the file. When I check for the submitted values, the file field is empty, but the file is in $_FILES.

Here is how I build the form:

function tag_graphics_form($form_state) {
    $form = array();
    $form['tag'] = array(
        '#required' =&gt; TRUE,
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Tag'),
        '#size' =&gt; 30,
      );
    $form['image'] = array(
        '#type' =&gt; 'file',
        '#title' =&gt; t('Image for tag page'),
        '#description' =&gt; 'Recommended width for image: 605px'
    );
    $form['description'] = array(
        '#type' =&gt; 'textarea',
        '#title' =&gt; t('Page Description for SEO')
    );
    $form['#attributes'] = array('enctype' =&gt; "multipart/form-data");
    $form['submit'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; 'Save'
    );
    return $form;
}


And this is how I process things in the submit:

function tag_graphics_form_submit( $form, &amp;$form_state ) {
    // save the image and put to the database
    print_r($form_state['values']);  // the image field is completely empty here. other fields are ok
    print_r($_FILES); // the uploaded file is here just fine
    if ($form_state['values']['image']) { // all of this used to work...
        $validators = array();
        $file = file_save_upload('image', $validators, file_directory_path());
        file_set_status($file, FILE_STATUS_PERMANENT);
        $filepath = $file-&gt;filepath;
    } 
    // more code...
}
function tag_graphics_form($form_state) {
    $form = array();
    $form['#attributes'] = array('enctype' =&gt; "multipart/form-data");
    $form['tag'] = array(
        '#required' =&gt; TRUE,
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Tag'),
        '#size' =&gt; 30,
      );
    $form['image'] = array(
        '#type' =&gt; 'file',
        '#title' =&gt; t('Image for tag page'),
        '#description' =&gt; 'Recommended width for image: 605px'
    );
    $form['description'] = array(
        '#type' =&gt; 'textarea',
        '#title' =&gt; t('Page Description for SEO')
    );

    $form['submit'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; 'Save'
    );
    return $form;
}

function tag_graphics_form_validate($form, &amp;$form_state){
  $field = 'image';

  $directory = file_directory_path();
  if (file_check_directory($directory, FILE_CREATE_DIRECTORY, $field)) {
    $validators = array();
    if ($file = file_save_upload($field, $validators, $directory)) {
      file_set_status($file, FILE_STATUS_PERMANENT);
      $form_state['storage']['file'] = $file;

    }
  }
}
function tag_graphics_form_submit(&amp;$form, &amp;$form_state){
  print_r($form_state['storage']['file']);
}