Reply To: Direct to S3 File Path
December 30, 2021 at 2:52 pm Reply
Support Manager
$entry['id']
Something like this:
add_filter( 'syncs3_put_object_file_path', 'customize_syncs3_path', 10, 6 );
/**
* Custom logic to set the bucket name in SyncS3 for Gravity Forms
*
* @param string $path File path to return. Make sure the path ends with $file_name.
* @param string $file Local file URL when uploaded
* @param string $file_name Name of uploaded file
* @param int $field_id ID of the fileupload field
* @param int $form_id ID of the form
* @param array $entry Entry data
*
* @return string Bucket name
*/
function customize_syncs3_path( $path, $file, $file_name, $field_id, $form_id, $entry ) {
// Custom logic
$path = "JobID:{$entry['id']}/{$file_name}"; // Make sure the new path includes the file name
return $path;
}
For more info about the entry data, see https://docs.gravityforms.com/entry-object/