gform_post_multifile_upload

gform_post_multifile_upload

DescriptionUsageParametersExamplesPlacementSource Code

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:
1add_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)
1add_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
1234567add_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.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注