Reputation: 1498
I want to set the content-disposition as attachment in a s3 bucket while
uploading file to S3 bucket ,below is my code im using.
$s3 = new S3(AWS_KEY, AWS_SECRET_KEY);
if ($s3->putObjectFile("$uploadDir/$file", AWS_BUCKET, "$targetDir/$file", S3::ACL_PUBLIC_READ)) {
$syncSize = $s3->getObjectInfo(AWS_BUCKET, "$targetDir/$file");
}
Upvotes: 0
Views: 1549
Reputation: 425
Add contentDisposition in putobject in php as 'ContentDisposition' => 'attachment',
$result = $client->putObject(array(
'Bucket' => $bucket,
'Key' => $fileName,
'SourceFile' => $fileTempName,
'ContentDisposition' => 'attachment',
'Metadata' => array(
'Foo' => 'abc',
'Baz' => '123'
)
));
Upvotes: 2