| CARVIEW |
Select Language
HTTP/2 301
date: Sat, 27 Dec 2025 16:17:59 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_media_upload_path/
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: HIT
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=eCTxa7HXZXAz%2FPSu5xH7K617ldp%2FhQqNlQs9kMsf78SZgIQ%2B0treqkx6GIJm8n5crdT1I3n6GLdoqApeONf6G8%2F2HtphgBBg8fCt73jwprTPumlQ"}]}
cf-ray: 9b4a21921ae0dfa6-BLR
HTTP/2 200
date: Sat, 27 Dec 2025 16:18:00 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: EXPIRED
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=Busx%2FGVLVSUHU76H4R2svNaXF7iznAJu0jx20528gHfwXPYc5V2UXic1KlxaHlzZZHoenfvU3rnPX4igog%2F%2Fmy8F3I9g%2FFv5SCdBim33qjQMMQLL"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b4a2197e94fdfa6-BLR
gform_media_upload_path - Gravity Forms Documentation
gform_media_upload_path
Description
This filter can be used to change the location where files uploaded using the Post Image field are copied to when the post is created.
Usage
The following would apply to all forms.
add_filter( 'gform_media_upload_path', '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. (format: gform_media_upload_path_FORMID)
add_filter( 'gform_media_upload_path_5', 'your_function_name', 10, 3 );
Parameters
Examples
1. Log the current path
You can use this example with logging enabled to find out what the current path is before using the next example to change the path.
add_filter( 'gform_media_upload_path', function ( $upload_dir, $form_id ) {
GFCommon::log_debug( "gform_media_upload_path(): upload_dir for form #{$form_id} => " . print_r( $upload_dir, true ) );
return $path_info;
}, 1, 2 );
2. Change the path and url
This example changes the upload path and url for the File Upload field.
add_filter( 'gform_media_upload_path', 'change_media_upload_path', 10, 3 );
function change_media_upload_path( $upload_dir, $form_id, $post_id ) {
$upload_dir['path'] = '/home/public_html/yourdomainfolder/new/path/';
$upload_dir['url'] = 'https://yourdomainhere.com/new/path/';
return $upload_dir;
}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFormsModel::copy_post_image() in forms_model.php
Since
This filter was added in Gravity Forms 1.9.14.19.