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 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真