| CARVIEW |
Select Language
HTTP/2 301
date: Sat, 27 Dec 2025 08:48:06 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_file_upload_tmp_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=dhdvGTG1xccAeKHqjijJfwJloqeNJ1V3AHH56fbugXiTuyMoso4Qe6p0XfbZ5OPfdu6IkAg0E2%2B3kEQkOEC%2FCM6VV3Su%2FAYAoXZYIPt3PQNGniVj"}]}
cf-ray: 9b478e8eebf2a45e-BLR
HTTP/2 200
date: Sat, 27 Dec 2025 08:48:06 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: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=f3LdDOR4yDpxWW6e0MCsPBoKWiGREItdEY0egQ5dpOOO0ObrtoNtjd4nKB%2B8KKEiQK5byWLafQLCR9PvAvnXzXc44AIgSqioGF1BlXQS3us8JcXW"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b478e95ccbda45e-BLR
gform_file_upload_tmp_dir - Gravity Forms Documentation
gform_file_upload_tmp_dir
Description
The gform_file_upload_tmp_dir filter allows developers to change the temporary directory used for file uploads.
Usage
Applies to all forms:
add_filter( 'gform_file_upload_tmp_dir', 'your_function_name', 10, 2 );
To target a specific form append the form id to the hook name. (format: gform_file_upload_tmp_dir_FORMID)
add_filter( 'gform_file_upload_tmp_dir_123', 'your_function_name', 10, 2 );
Parameters
- $tmp_upload_locations array
An array containing the path and url of the temporary upload directory. - $form_id int
The ID of the form.
Examples
Change the temporary file upload directory
add_filter( 'gform_file_upload_tmp_dir', function ( $tmp_upload_locations, $form_id ) {
return array(
'path' => '/Users/morgan/Local/gravity-forms/app/public/wp-content/uploads/gravity_forms/' . $form_id . '/tmp/',
'url' => 'https://gravity-forms.local/wp-content/uploads/gravity_forms/' . $form_id . '/tmp/'
);
}, 10, 2 );
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?
Source Code
This filter is located in /form_display.php
Since
The filter was added in Gravity Forms 2.9.3