gform_file_permission

Description

This filter is executed when uploading a file. It can be used to change the default permissions of uploaded files.

Usage

Applies to all forms.

add_filter( 'gform_file_permission', 'set_file_permission', 10, 2 );

Parameters

  • $permission string

    The file permission to be filtered (i.e. 0755).

  • $path string

    The full file path.

Examples

This example changes the permissions of uploaded files to 0755.

add_filter( 'gform_file_permission', 'set_file_permission', 10, 2 );
function set_file_permission( $permission, $path ) {
    // Note the octal value with the leading zero. Don't return a string.
    return 0755;
}

Source Code

This filter is located in GFFormsModel::set_permissions() in forms_model.php.