2016-09-15 85 views
0

我想設置的內容配置爲在S3存儲桶附件而PHP設置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"); 

} 

回答

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>