Upload multiple files (with multiple attr) in custom form: how to get files? I've made a form. Now I want it to upload files. I've made a form element to do that:

  $form['attachments'] = array(
    '#type' =&gt; 'file',
    '#title' =&gt; t('Attachments'),
    '#name' =&gt; 'attachments[]',
    '#attributes' =&gt; array('multiple' =&gt; ''),
  );


I've set #name and #attributes.multiple because I want to use the HTML5 multiple files upload thingie. They invented that for a very good reason. I assume Drupal knows how to handle that.

How do I get the files in the submit handler? I don't want to save them to the file system. I want to e-mail them.

Ofcourse (?) I can just query $_FILES, but even I think that's not right in a framework like Drupal.

Is there a better way?
I haven't tried HTML5 Upload yet, but it might help you out.