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' => 'file',
'#title' => t('Attachments'),
'#name' => 'attachments[]',
'#attributes' => array('multiple' => ''),
);
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?