How to upload multiple files directly to Amazon S3?

I am trying to get an Amazon S3 Plupload example while working with Node.js. However, so far I have managed to get Error #2049 . I'm not sure what I'm doing wrong. I uploaded the crossdomain.xml file.

Here is my political document and signature:

 var crypto = require('crypto'); var s3 = {} s3.bucket = 'BUCKET'; s3.accessKeyId = 'ACCESS_KEY'; s3.aws_secret_key = 'SECRET_KEY'; s3.policy = JSON.stringify({ 'expiration': '2012-10-01T00:00:00Z', 'conditions': [ {'bucket': s3.bucket }, {'acl': 'private'}, ['starts-with', '$key', ''], ['starts-with', '$Content-Type', ''], ['starts-with', '$name', ''], ['starts-with', '$Filename', ''], {"success_action_status" : "201"} ]}); s3.policy = new Buffer(s3.policy).toString('base64'); s3.signature = crypto.createHmac('sha1', s3.aws_secret_key).update(s3.policy).digest('base64'); 

Am I doing something wrong?

+4
source share
1 answer

If I were you, I would use a library that can already talk to Amazon S3. I would recomment AwsSum since I wrote it, but there are others.

Also consider examples so you can see what to do:

+1
source

Source: https://habr.com/ru/post/1389294/


All Articles