AmazonS3 SDK:下载时更改文件名


Amazon S3 SDK: Change filename on download?

这是生成URL并更改其下载名称的正确方法吗?

$s3 = new AmazonS3();
$opt =  array('response' => array('Content-Disposition' => 'attachment; "filename=newname.txt"'));
$url = $s3->get_object_url('bucket', 'file.txt', '5 minutes', $opt));

显然对我不起作用。

经过几次测试后,显然get_object_url要求Content-Disposition参数大小写较低。

请注意,create_object的情况并非如此,它不区分大小写。

所以上面的工作代码是:

$opt =  array('response' => array('content-disposition' => 'attachment; "filename=newname.txt"'));