Closed damianbuttle closed 6 years ago
I have been able to upload to my amazon S3 bucket, perfectly, but when I try and display the new file name in the confirmation, all that displays is undefined.
` var upload = multer({ storage: multerS3({ s3: s3, bucket: 'imagebucket', acl: 'public-read', metadata: function (req, file, cb) { cb(null, Object.assign({}, req.body)); }, key: function (req, file, cb) { console.log(file); cb(null, Date.now()+file.originalname); } }) })
app.post('/upload', upload.single('upload'), function(req, res, next) { res.send('Successfully uploaded ' + req.file.length + ' file!') })`
and this is my form:
`
<p> <input type="file" name="upload"/> </p> <p></p> <p> <input type="submit"/> </p> </form>`
'Successfully uploaded ' + req.file.length + ' file!'
I think you meant to look at req.file.key instead of req.file.length?
req.file.key
req.file.length
Perfect, thanks :-)
I have been able to upload to my amazon S3 bucket, perfectly, but when I try and display the new file name in the confirmation, all that displays is undefined.
` var upload = multer({ storage: multerS3({ s3: s3, bucket: 'imagebucket', acl: 'public-read', metadata: function (req, file, cb) { cb(null, Object.assign({}, req.body)); }, key: function (req, file, cb) { console.log(file); cb(null, Date.now()+file.originalname); } }) })
and this is my form:
`