I've been following the form example 10 from the Drupal doc: http://api.drupal.org/api/examples/form_example!form_example.module/group/form_example/7
Here goes the definition of my form:
function portal_upload_form($form, $form_state) {
$form['file'] = array(
'#type' => 'file',
'#title' => t('Choose a file'),
);
$form['document_submit_button'] = array(
'#type' => 'submit',
'#value' => t('upload'),
);
return $form;
}
And the form_submit hook:
function portal_upload_form_submit($form, &$form_state) {
$file = $form_state['values']['file'];
// ...
$file is 'empty' despite having set an input file with 777 permissions. I'm missing something and can't find what on my own...
Thanks! J.
Doesn't answer the question of why the form doesn't provide with a file/url/... but it solves the whole upload issue:
function portal_upload_form_submit($form, &$form_state) {
$file = $form_state['values']['file'];
$validators = array();
$file = file_save_upload('file', $validators, 'public://');