Allow add-ons and custom code to skip the required file exists validation.


The filter which runs for all forms would be used like so:

add_filter( 'gform_validate_required_file_exists', 'require_file', 10, 3 );

You can also target a specific form by adding the form id after the filter name:

add_filter( 'gform_validate_required_file_exists_17', 'require_file', 10, 3 );

To target a specific field append both the form id and the field id to the hook name:

add_filter( 'gform_validate_required_file_exists_17_8', 'require_file', 10, 3 );


  • $validate boolean
    Whether to validate the required file exists. Default is true.
  • $file array
    The file information.
  • $field field object
    The current field object.


Note: This is a simple usage example. For security, it is recommended you perform some checks on the $file before returning false.

add_filter( 'gform_validate_required_file_exists', 'require_file', 10, 3 );
function require_file( $validate, $file, $field ) {
    return $validate;


This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

The filter is located in GF_Field_FileUpload::is_value_submission_empty() in /includes/fields/class-gf-field-fileupload.php


This filter was added in Gravity Forms 2.7.4.