what does "upload.array('photos', 3) " in the following code denotes ....
My html code. (code reduced for brevity)
<form action="/upload" method="POST">
<input type="file" name="pic" id="pic" accept="image/*">
<input type="submit">
</form>
my expressjs code
AWS.config.update({
accessKeyId: "xxxxxxxxxxxxx",
secretAccessKey: "yyyyyyyyyy",
"region": "zzzzzzzzz" ,
signatureVersion: 'v4'
});
var s3=new AWS.S3();
var upload = multer({
storage: multerS3({
s3: s3,
bucket: 'imgcontainer',
metadata: function (req, file, cb) {
cb(null, {fieldName: file.fieldname});
},
key: function (req, file, cb) {
cb(null, Date.now().toString())
}
})
})
app.post('/upload', upload.array('photos', 3), function(req, res, next) {
res.send('Successfully uploaded ' + req.files.length + ' files!')
})
output:
Cannot read property 'length' of undefined
via V Abinaya
No comments:
Post a Comment