title: Drupal: File upload required?
body: <p>For some reason, my form breaks when I try to make a file upload required. Here is the code for it:</p>
  
  <pre><code>$form_id = "upload_form";
  
  $form[$form_id] = array (
      '#type' =&gt; 'fieldset',
      '#description' =&gt; t('This is a utility to import nodes from a Comma Separated Value file. To begin, pick a node type, and upload a CSV.'),
  );
  
  $form[$form_id]['type'] = array(
      '#title' =&gt; t('Enter node type'),
      '#type' =&gt; 'textfield',
  //      '#autocomplete_path' =&gt; '', TODO: autocomplete for node types
      '#required' =&gt; TRUE,
      '#description' =&gt; t('This node type should already exist. If it doesn\'t, create it first.'),
  );
  
  $form[$form_id]['upload'] = array(
      '#type' =&gt; 'file',
      '#title' =&gt; t('Upload CSV file'),
  //      '#size' =&gt; 40,
      '#description' =&gt; t('This will not work for a non-CSV file.'),
  //      '#required' =&gt; TRUE, TODO: breaks it. why?
  );
  
  $form[$form_id]['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Submit'),
  );
  
  $form['#attributes'] = array('enctype' =&gt; 'multipart/form-data');
  </code></pre>
  
  <p>On a Drupal support <a href="http://drupal.org/node/419684" rel="noreferrer">site</a>, someone says that it's impossible to make file uploads required. Is this true?</p>