// adds :filename modifier to the single file upload field
add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {
if ( $merge_tag != 'all_fields' && $field->type == 'fileupload' && $modifier == 'filename' ) {
$value = str_replace( ' ', '%20', $raw_value );
$pathinfo = pathinfo( $value );
$value = rgar( $pathinfo, 'basename' );
}
return $value;
}, 10, 6 );