The gform_dropbox_file_name is a Gravity Forms filter that allows you to override the filename before the file is uploaded to Dropbox.
Usage
To apply this filter 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:
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 (Form Object): 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.
More information
See Gravity Forms Docs: gform_dropbox_file_name
Examples
Use an entry value in the filename
This example demonstrates how to 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; }
Place this code in the functions.php
file of your active theme.