gform_post_multifile_upload

Description

The “gform_post_multifile_upload” action in Gravity Forms allows further actions to be performed after multiple files have been uploaded.

Usage

The following would apply to all forms:

add_action( 'gform_post_multifile_upload', 'your_function_name', 10, 5 );

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

add_action( 'gform_post_multifile_upload_2', 'your_function_name', 10, 5 );

Parameters

  • $form Form Object

    The form object.

  • $field Field Object

    The field object.

  • $uploaded_filename string

    The name of the file uploaded.

  • $tmp_file_name string

    The temporary name of the file while it was uploaded.

  • $file_path string

    The path where the file is uploaded.

Examples

add_action( 'gform_post_multifile_upload', 'upload_alert', 10, 5 );
function upload_alert( $form, $field, $uploaded_filename, $tmp_file_name, $file_path ){
	$dirname = dirname( $file_path );
	if ( $uploaded_filename == '600x500.png' ){
		copy( $file_path,  $dirname . '\backup_' . $uploaded_filename );
	}
}

Placement

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

Source Code

This filter is located in GFAsyncUpload::upload() in upload.php.