0
votes

I am using fine uploader for amazon s3 But when i am try to upload file. Error show : The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

Page Url: 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";
1

1 Answers

1
votes

This error is common for when your region isn't matched correctly. You may want to double check that the region you specify in your code matches the bucket you created.