0
我已經能夠使用NodeJS/Express/Amazon S3/Multer一次設置上傳單個圖像的過程。它完美的作品。我一直在嘗試更改代碼以允許用戶一次上傳多個圖像。到目前爲止,我一直非常失敗。我如何更改我的代碼以允許多個圖像一次上傳?謝謝!上傳多張圖片 - NodeJS和Amazon S3
aws.config.update({
secretAccessKey: '*****************',
accessKeyId: '******',
region: 'us-east-2'
});
var s3 = new aws.S3();
var upload = multer({
storage: multerS3({
s3: s3,
bucket: 'myfiles',
key: function (req, file, cb) {
var fileExtension = file.originalname.split(".")[1];
var path = "uploads/" + req.user._id + Date.now() + "." + fileExtension;
cb(null, path);
}
})
});
router.post("/", upload.array('image', 1), function(req, res, next){
var filepath = undefined;
if(req.files[0]) {
filepath = req.files[0].key;
}......