When a form with upload file elements is embedded into another form and submitted, upload elements don't work - nothing is uploaded.
This happens because subform_element doesn't set $form['#attributes'] = array('enctype' => 'multipart/form-data'); automatically in case at least one upload element is found.

Is it possible to fix?
Thanks.

Comments

alanburke’s picture

+1
I'm using this module, in conjunction with nodeprofile, and within that, filefield.

With the latest version of filefield, when you try to upload the file.
The ajax repsonse is an sql error.

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM content_ WHERE vid = 0 LIMIT 0, 1' at line 1 query: SELECT FROM content_ WHERE vid = 0 LIMIT 0, 1 in C:\workspace\drupal56\includes\database.mysql.inc on line 172.

Otherwise, the module is pretty neat.
Any advice on how to fix this would be appreciated.

Regards
Alan

fago’s picture

Status: Active » Fixed

that's not true, file uploads work. Its documented that the enclosing form builder has to set
$form['#attributes'] = array('enctype' => 'multipart/form-data');
if one wants to use file uploads too.

The other one, is an incompatibility with the ajax stuff from filefield and imagefield. Yes, for this too work one needs to set data separation to false.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

thepanz’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Postponed (maintainer needs more info)

I got this issue ( Subform not working with Imagefield CCK), I used #data_serparation = FALSE, but I noticed that using Subform elements, passed FORM don't include [files] item, so Imagefield nor FileUploads works, any solution?

Regards

*edit* Resolved: I added a comment to documentation about it, maybe other users need to know about FileUpload without look into "Closed" issues. :) Read it here: http://drupal.org/node/133725#comment-849347

fago’s picture

Status: Postponed (maintainer needs more info) » Fixed

thanks, I've changed the module to have data separation off by default now.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.