【问题标题】:fine uploader with amazon s3亚马逊 s3 的优秀上传器
【发布时间】:2017-01-05 12:14:23
【问题描述】:

我正在使用适用于 amazon s3 的精细上传器但是当我尝试上传文件时。 错误显示:您提供的授权机制不受支持。请使用 AWS4-HMAC-SHA256。

页面网址: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";

【问题讨论】:

    标签: amazon-web-services amazon-s3 fine-uploader


    【解决方案1】:

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

    【讨论】:

    • $clientPrivateKey = $_ENV['AWS_CLIENT_SECRET_KEY']; // 这两个键仅在启用删除文件功能时才需要 // 或者,例如,如果您通过 S3 的 SDK 在 successEndpoint // 处理程序中确认文件大小,正如我们在本示例中所做的那样。 $serverPublicKey = $_ENV['AWS_SERVER_PUBLIC_KEY']; $serverPrivateKey = $_ENV['AWS_SERVER_PRIVATE_KEY']; console.aws.amazon.com/iam/home?region=ap-south-1#/… 我找到了 $serverPublicKey = $_ENV['AWS_SERVER_PUBLIC_KEY']; $serverPrivateKey = $_ENV['AWS_SERVER_PRIVATE_KEY'];如何找到此密钥
    猜你喜欢
    • 1970-01-01
    • 2013-10-29
    • 2012-03-30
    • 2011-12-05
    • 1970-01-01
    • 2012-10-11
    • 2012-07-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多