2 Answers
- Newest
- Most votes
- Most comments
0
Ahh!!! That's it ... TagSet is an array of arrays inside an array inside an array 🙄 I must have gone code blind after staring at it for so long 😂
answered 8 months ago
0
Hello.
I tried running the code below in my environment, but no error occurred.
<?php
require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\Exception\AwsException;
$s3Client = new S3Client([
'region' => 'ap-northeast-1',
'version' => '2006-03-01'
]);
$result = $s3Client->putObjectTagging([
'Bucket' => 'S3-Bucket-Name', // REQUIRED
'Key' => 'test.yml', // REQUIRED
'Tagging' => [ // REQUIRED
'TagSet' => [ // REQUIRED
[
'Key' => 'wizard', // REQUIRED
'Value' => '1' // REQUIRED
]
]
]
]);
I think you will be successful if your code is as below.
Try modifying it to the following code.
$result = $s3Client->PutObjectTagging([ 'Bucket' => $launch_bucket,
'Key' => $zipfilename,
'Tagging' => [
'TagSet' => [
[
'Key' => 'wizard',
'Value' => '1'
]
]
]
]);
Relevant content
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
Hi,
That's great to hear, thanks for your reply!
I'm struggling to see what's different though - apart from the S3 initialisation it all looks the same as I have?
David
Comparing your code and mine, there are differences as follows.
My Code:
Your Code: