我使用以下代码生成直接上传到S3的签名(使用sig v4,因为存储桶位于法兰克福):
$s3 = S3Client::factory(array(
'key' => Configure::read('Aws.key'),
'secret' => Configure::read('Aws.secret'),
'region' => Configure::read('Aws.region'),
'signature' => 'v4'
)
);
$postObject = new \Aws\S3\Model\PostObject($s3, Configure::read('Aws.bucket'),
array('acl' => 'public-read'));
$form = $postObject->prepareData()->getFormInputs();
$this->set('policy', $form['policy']);
$this->set('signature', $form['signature']);
但是,POST的最终结果始终是包含以下消息的XML响应:
The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.
任何人都可以看到我可能做错了吗?