首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用亚马逊s3的优秀上传器

使用亚马逊s3的优秀上传器
EN

Stack Overflow用户
提问于 2017-01-05 12:14:23
回答 1查看 561关注 0票数 0

我正在使用良好的上传亚马逊s3,但当我试图上传文件。错误显示:不支持您提供的授权机制。请使用AWS4-HMAC-SHA256 256.

页面网址:http://clientuat.xyz/s3demo2/

代码语言:javascript
复制
 <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";
EN

回答 1

Stack Overflow用户

发布于 2017-01-06 05:35:46

当您的区域没有正确匹配时,此错误很常见。您可能需要再次检查您在代码中指定的区域是否与您创建的桶匹配。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41484873

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档