我希望在
中将内容处置设置为s3存储桶中的附件将文件上传到S3存储桶,下面是我使用的代码。
$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");
}
答案 0 :(得分:1)
Add contentDisposition in putobject in php as **'ContentDisposition' => 'attachment',**
<pre>
$result = $client->putObject(array(
'Bucket' => $bucket,
'Key' => $fileName,
'SourceFile' => $fileTempName,
'ContentDisposition' => 'attachment',
'Metadata' => array(
'Foo' => 'abc',
'Baz' => '123'
)
));
</pre>