Browser Based File Upload on AWS S3 using POST Request

后端 未结 1 331
感动是毒
感动是毒 2021-01-21 01:10

This is my HTML POST Form.


  

    

  
  &l         


        
1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-21 02:07

    You will have to calculate the signature from backend. Follow these details Calculating a Signature to implement at your own.

    That would be something like this:

    $kDate = hash_hmac('sha256', $short_date, 'AWS4' . $secret_key, true);
    $kRegion = hash_hmac('sha256', $region, $kDate, true);
    $kService = hash_hmac('sha256', "s3", $kRegion, true);
    $kSigning = hash_hmac('sha256', "aws4_request", $kService, true);
    $signature = hash_hmac('sha256', base64_encode($policy), $kSigning);
    

    Or you can use any of the AWS SDKs of your choice.

    For example using PHP SDK you would implement:

    Aws\Signature\S3SignatureV4
    

    0 讨论(0)
提交回复
热议问题