Reply To: How to tag individual files on upload to S3?
February 26, 2022 at 8:59 am Reply
Support Manager
Hi Martin,
Currently, there’s no visual method of adding tags. However, you can use the syncs3_putobject_args filter to modify the parameters of the putObject call. A full list of the parameters can be found at https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#putobject.
Here’s an example snippet that will help you get started:
add_filter( 'syncs3_putobject_args', 'syncs3_putobject_args_tags', 10, 4 );
/**
* Modifies the putObject args to add the Tagging parameter.
*
* @param array $args Current putObject parameters
* @param string $file Local file URL when uploaded
* @param array $entry Entry data
* @param int $form_id Form ID
*
* @return array
*/
function syncs3_putobject_args_tags( $args, $file, $entry, $form_id ) {
$args['Tagging'] = 'Key1=Value1';
return $args;
}