2017-01-05 7 views
0

amazon s3のアップローダーを使用していますが、ファイルをアップロードしようとしています。 エラー表示:提供した承認メカニズムはサポートされていません。 AWS4-HMAC-SHA256を使用してください。amazon s3のアップローダ

ページの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

このエラーは、お住まいの地域が正しく一致しないときのために一般的です。コードで指定したリージョンが、作成したバケットと一致しているかどうかを再度確認することができます。

+0

$ clientPrivateKey = $ _ENV ['AWS_CLIENT_SECRET_KEY']; //この2つのキーは、ファイル削除機能が有効になっている場合にのみ必要です。//たとえば、この例のようにsuccess_ndpoint // S3ハンドラのファイルサイズを確認してください。 $ serverPublicKey = $ _ENV ['AWS_SERVER_PUBLIC_KEY']; $ serverPrivateKey = $ _ENV ['AWS_SERVER_PRIVATE_KEY']; https://console.aws.amazon.com/iam/home?region=ap-south-1#/security_credential 見つかりました $ serverPublicKey = $ _ENV ['AWS_SERVER_PUBLIC_KEY']; $ serverPrivateKey = $ _ENV ['AWS_SERVER_PRIVATE_KEY']; このキーを見つける方法 –