duanjia6959 2016-09-15 19:57
浏览 59
已采纳

php设置s3内容 - 配置作为附件

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");

}
  • 写回答

1条回答 默认 最新

  • dsfs21312 2017-01-11 14:01
    关注
    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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题