pin.js
function uploadPinMedia(req, res, next) {
var s3 = new AWS.S3({
accessKeyId: 'AKIAIUCBE3TQGL6ATPBA',
secretAccessKey: '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',
Bucket: 'mapery-v2'
});
var data = {
Bucket: 'mapery-v2',
Key: 'upload-v2',
Body: req.files.pin_img
};
s3.putObject(data, function(err, media_res) {
if(err)
console.log('error uploading data', media_res);
console.log(media_res);
});
}
I am trying to upload an image to s3 bucket from postman, but it seems to be the form data
req.files.pin_img
I am passing is not correct. Am I wrong anywhere ??