spivurno
3/14/2017 - 1:36 PM

Gravity Perks // GP Preview Submission // Display Filename for File Upload Fields

Gravity Perks // GP Preview Submission // Display Filename for File Upload Fields

<?php
/**
 * Gravity Perks // GP Preview Submission // Display Filename for File Upload Fields
 * http://gravitywiz.com/documentation/gravity-forms-preview-submission/
 */
add_filter( 'gpps_special_merge_tags_value_fileupload', function( $value, $field, $input_id, $modifier, $form, $entry ) {

    if( ! $field->multipleFiles ) {
	    $input_name = 'input_' . str_replace( '.', '_', $field->id );
	    $file_info  = GFFormsModel::get_temp_filename( $form['id'], $input_name );
	    $value = $file_info['uploaded_filename'];
    }

    return $value;
}, 10, 6 );