The gform_plupload_settings filter allows you to modify the initialization settings for Plupload when the “allow multiple files” option is enabled in Gravity Forms.
Usage
To apply the filter to all forms, use the following code:
add_filter('gform_plupload_settings', 'your_function_name', 10, 3);
To limit the scope of your function to a specific form, append the form id to the end of the hook name:
add_filter('gform_plupload_settings_75', 'init_plupload_settings', 10, 3);
Parameters
$settings
(array): An array of the current settings for Plupload.$form_id
(integer): The ID of the form in use.$field
(GF_Field_Fileupload): The field object.
More information
See Gravity Forms Docs: gform_plupload_settings
Examples
Maximum File Size
Change the maximum file size allowed for file uploads:
add_filter('gform_plupload_settings', 'init_plupload_settings', 10, 3); function init_plupload_settings($settings, $form_id, $field) { $settings['filters']['max_file_size'] = '100kb'; return $settings; }
Modify Uploader URL
Change the uploader URL:
add_filter('gform_plupload_settings', function($settings, $form_id, $field) { $settings['url'] = trailingslashit(site_url()) . '?gf_page=' . GFCommon::get_upload_page_slug(); return $settings; }, 10, 3);
Place the code examples in the functions.php
file of your active theme.