Description
The gform_cleanup_target_dir
filter is used to bypass functionality that relies on open_dir()
, enabling support for the multi-file upload field on servers that don’t support open_dir()
, such as WordPress VIP.
Usage
The filter which runs for all multi-file enabled file uploads would be used like so:
add_filter( 'gform_cleanup_target_dir', 'your_function_name' );
Parameters
- $cleanup_target_dir boolean
Indicates if old temporary files should be removed from the forms tmp directory. Default:true
.
Example
add_filter( 'gform_cleanup_target_dir', '__return_false' );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This filter was added in Gravity Forms v2.6.4.
Source Code
This filter is located in GFAsyncUpload::upload() in includes/upload.php.