-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Description
The hasFile() function is designed to determine if a form includes file fields and applies the necessary enctype="multipart/form-data" attribute. However, it only checks for fields that are instances of Field\File or Field\MultipleFile.
I have implemented a custom file uploader with cropping functionality. Since my custom fields do not extend from either of the expected classes (Field\File or Field\MultipleFile), the hasFile() function fails to recognize them as file upload fields. Consequently, the form does not receive the correct enctype attribute, causing the file uploads to fail.
Proposed Solution
Allow hasFile() to be extensible or configurable so that it can detect custom file fields. Example:
if ( $field instanceof Field\File || $field instanceof Field\MultipleFile || ( method_exists($field, 'isFileField') && $field->isFileField() ) ) {