Description
This filter is executed before uploading a file (by the File Upload or Post Image fields). It can be used to change the location where uploaded files are stored.
Usage
Applies to all forms
<?php
add_filter("gform_upload_path", "upload_path", 10, 2);
?>
Applies to a specific form. In this case, form Id 5
<?php
add_filter("gform_upload_path_5", "upload_path", 10, 2);
?>
Parameters
$path_info
- (Array) The upload path to be filtered. It is an associative arrays with two keys that must be specified.
- $path_info["path"] = "Full physical path to upload folder";
- $path_info["url"] = "Full URL to upload folder";
$form
- (Form Object) The current form.
Examples
This example changes the notification's BCC field, adding values from posted fields.
<?php
add_filter("gform_upload_path", "change_upload_path", 20, 2);
function change_upload_path($path_info, $form_id){
$path_info["path"] = "/new/path/";
$path_info["url"] = "http://new_url.com/images/";
return $path_info;
}
?>
Source Code
This filter is located in forms_model.php