bookmark_bordergform_dropbox_file_name

Description

This filter can be used to override the filename before the file is uploaded to Dropbox.

Usage

The following would apply to all forms:

add_filter( 'gform_dropbox_file_name', 'your_function_name', 10, 5 );

To target a specific form append the form id to the hook name. (format: gform_dropbox_file_name_FORMID)

add_filter( 'gform_dropbox_file_name_10', 'your_function_name', 10, 5 );

Parameters

  • $file_name string

    The filename, including extension. e.g. screenshot.png

  • $form

    The form currently being processed.

  • $field_id string

    The ID of the field currently being processed.

  • $entry Entry Object

    The entry currently being processed.

  • $feed Feed Object

    The feed currently being processed.

Examples

1. Use an entry value in the filename.

This example shows how you can use a value from the Entry Object when modifying the filename.

add_filter( 'gform_dropbox_file_name_10', 'change_name', 10, 5 );
function change_name( $file_name, $form, $field_id, $entry, $feed ) {

    return rgar( $entry, 'id' ) . '-' . $file_name;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

gf_apply_filters( 'gform_dropbox_file_name', $form['id'], $file['name'], $form, $field_id, $entry, $feed )

This filter is located in the following methods in class-gf-dropbox.php

  • GFDropbox::upload_file()
  • GFDropbox::process_dropbox_fields()