Gravity Forms to Zapier upload file url not formatted properly

If you are having an issue with Gravity Forms upload file field not being sent into another application through Zapier it may be due to the formatting that Gravity Forms applies to file URL’s when using the Multiple Upload feature on that field type.

Instead of sending out a regular URL, Gravity Forms sends out a JSON formatted URL that is not automatically corrected by other applications like Zapier.

["https:\/\/gravityforms.com\/wp-content\/uploads\/gravity_forms\/7-47b7172130e47c524f6c04a54dd80793\/2022\/10\/image1.png"]

Here is a code snippet to normalize that JSON encoding of the URL from multiple file upload fields:

add_filter( 'gform_zapier_field_value', function ( $value, $form_id, $field_id, $entry ) {
    $field = GFAPI::get_field( $form_id, $field_id );
 
    if ( $field instanceof GF_Field_FileUpload && $field->multipleFiles && ! empty( $value ) ) {
        $value = json_decode( $value );
    }
 
    return $value;
}, 10, 4 );

Add the above code to your functions.php file or via a plugin like Code Snippets

This will send regular URL’s that Zapier can properly pass through to applications like Airtable and they will read as files to be able to be uploaded into another application.

Shopping Cart