| CARVIEW |
Select Language
HTTP/2 301
date: Tue, 30 Dec 2025 07:58:25 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_cleanup_target_dir/
server: cloudflare
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
x-redirect-by: WordPress
fastcgi-cache: MISS
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=%2FvoYMUHbs9d673uXWFSzTThHpekRs%2B6bQiseGd6XbEWQGF%2FRntBe52jxRFaSZHWtS5DifC6RDHQy6C4nsbt%2FfSPr6sYskWq2FhdRcqMvMp0Kx7ni"}]}
cf-ray: 9b5ffdebde0b9dfd-BLR
HTTP/2 200
date: Tue, 30 Dec 2025 07:58:26 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
fastcgi-cache: MISS
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=lC%2FuiJZ9ePqJ%2BhHmI3NdSZoXdEGV7Pq2h0ToOfUMwcPIZcGYf4GcIAs%2FEKexWYxMtCDwdxoxHEhHfKqGIf9vN4jpttV5pftGtCgcq9V6T7A1q97O"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b5ffdf22d609dfd-BLR
gform_cleanup_target_dir - Gravity Forms Documentation
gform_cleanup_target_dir
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.