Use a field value to create a folder name for the upload

0 0

Using gform_upload_path you can change the location where uploaded files are stored. In this example, you can add a subfolder name for every upload using value from field 1.

add_filter( 'gform_upload_path', 'change_upload_path', 10, 2 );
function change_upload_path( $path_info, $form_id ) {
    $name = rgpost( 'input_1' );
    $path_info['path'] = "/path/to/yourdomainfolder/new/path/$name/";
    $path_info['url']  = "http://yourdomainhere.com/new/path/$name/";

    return $path_info;

Leave Your Observation

Your email address will not be published. Required fields are marked *