File upload values return as a string when added in a subform
Closed this issue · 1 comments
timhj commented
When the file uploads are in a subform the value only returns a string (which is the originating name of the file). It doesn't validate for that reason as it's not a _FILES array.
eg:
$form->$current_sub_form->photo_upload->val(); // returns a string when looping through sub forms
$form->photo_upload->val(); // returns a _FILES array correctly if it's not in a subform
bmidget commented
As mentioned in Disqus, the problem is because subforms don't automatically add the enctype="multipart/form-data"
to the parent form attribute.
Obiously this is unexpected in practice since when you add a field to a flat form, the attribute is automatically added.