Drupal 6 hook_form_FORM_ID_alter adding upload file field

Posted by kristian nissen on Stack Overflow See other posts from Stack Overflow or by kristian nissen
Published on 2009-10-27T11:50:54Z Indexed on 2010/06/15 1:02 UTC
Read the original article Hit count: 202

Filed under:
|

I'm trying to extend a form and add an upload file field from within a module, I can see the file field just fine, but it's empty when I submit the form, the enctype is set.

  $form['#attributes'] = array(
    'enctype' => "multipart/form-data"
  );

  $form['file_upload'] = array(
    '#type' => 'file',
    '#title' => 'Attach Image'
  );

custom form submit hook:

$form['#submit'][] = 'user_images_handler';

is being called, but when I dump the form, the file field is empty, and when I try to access it, it's empty as well.

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-6