I have a set of >100 webforms in my projects.
I need to add an upload field to all webforms in my hook_form_alter()
.
I guess I need to do something like the following.
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
if (strpos($form_id, 'webform_client_form_') === 0) {
$form['file'] = array(
'#type' => 'file',
'#title' => t('File'),
'#weight' => 50,
);
}
}
I need to set as on certain attributes such as:
- fieldkey
- max upload size
- allowed file extensions
How can this be achieved?