function uploadPinMedia(req, res, next) {
console.log(req.file);
var s3 = new AWS.S3({
params: {
Bucket: 'mapery-v2'
}
})
AWS.config.update({
accessKeyId: 'xxxxxxxxxxxxxxxxxxxx',
secretAccessKey: 'xxxxxxxxx+xxxxxxxxxxxxxxxxxxxxx/xxxxxxxx',
});
var file = req.file;
s3.upload({
ACL: 'public-read',
Body: fs.createReadStream(req.file),
Key: 'upload-v2',
}, (err, media_res) => {
console.log(err, media_res)
});
}
我正在尝试通过邮递员将图片上传到s3存储桶,但它给了我一个像TypeError: path must be string or buffer
这样的错误。怎么解决这个?