What do I send as a parameter to file_check_upload when the file field is a child of a fieldset with #tree set to true? For example: if my fieldset is called 'photo' and my file field is called 'upload'

Comments

ninetwenty’s picture

I've found the reference to form_set_error where you user the form foo][bar to set an error for bar, tried this format in file_check_upload, no luck. Has anybody got any idea? I've looked at the code for file_check_upload and to my eye it doesn't seem capable of dealing with this situation.

jcastr1’s picture

I also had this same exact problem with 4.7, here is what I did.

  //start HTML fieldset tag
  $form['start_fieldset'] = array('#type' => 'markup', '#value' => '<fieldset <legend>Logo Options</legend>');

 //Enter all your fields below...
  $form['logo'] = array(
        '#type' => 'file',
        '#title' => t('Attach new file'),
        '#size' => 40,
  );

  //close the HTML fieldset tag
  $form['end_fieldset'] = array('#type' => 'markup', '#value' => '</fieldset>');

This will force the drupal to display the form field without modifying the data structure - how is should be.

enjoy.