我正在使用良好的上传亚马逊s3,但当我试图上传文件。错误显示:不支持您提供的授权机制。请使用AWS4-HMAC-SHA256 256.
页面网址:http://clientuat.xyz/s3demo2/
<script>
var s3Uploader = new qq.s3.FineUploader({
debug: true,
element: document.getElementById('fine-uploader-s3'),
template: 'qq-template-s3',
request: {
endpoint: 'mybucketname.s3.amazonaws.com',
accessKey: "here is my key"
},
signature: {
endpoint: "s3demo-thumbnails-cors.php"
},
uploadSuccess: {
endpoint: "s3demo-thumbnails-cors.php?success",
params: {
isBrowserPreviewCapable: qq.supportedFeatures.imagePreviews
}
},
iframeSupport: {
localBlankPagePath: "success.html"
},
cors: {
expected: true
},
chunking: {
enabled: true
},
resume: {
enabled: true
},
deleteFile: {
enabled: true,
method: "POST",
endpoint: "s3demo-thumbnails-cors.php"
},
validation: {
itemLimit: 5,
sizeLimit: 15000000
},
thumbnails: {
placeholders: {
notAvailablePath: "not_available-generic.png",
waitingPath: "waiting-generic.png"
}
},
callbacks: {
onComplete: function(id, name, response) {
var previewLink = qq(this.getItemByFileId(id)).getByClass('preview-link')[0];
if (response.success) {
previewLink.setAttribute("href", response.tempLink)
}
}
} });
</script>
require 'aws-autoloader.php';
use Aws\S3\S3Client;
// Instantiate an Amazon S3 client.
$s3 = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-west-1',
'credentials' => false,
'signature_version'=> 'v4'
]);
//
// These assume you have the associated AWS keys stored in
// the associated system environment variables
$clientPrivateKey ="private key";
// These two keys are only needed if the delete file feature is enabled
// or if you are, for example, confirming the file size in a successEndpoint
// handler via S3's SDK, as we are doing in this example.
$serverPublicKey = "key";//$_SERVER['PARAM1'];
$serverPrivateKey = "private key";//$_SERVER['PARAM2'];
// The following variables are used when validating the policy document
// sent by the uploader:
$expectedBucketName = "bucket name";发布于 2017-01-06 05:35:46
当您的区域没有正确匹配时,此错误很常见。您可能需要再次检查您在代码中指定的区域是否与您创建的桶匹配。
https://stackoverflow.com/questions/41484873
复制相似问题