anacronw / multer-s3

multer storage engine for amazon s3
MIT License
660 stars 191 forks source link

Get response from S3 #5

Closed sprakashg closed 8 years ago

sprakashg commented 9 years ago

I used it this way.

var multer = require('multer');
var s3 = require('multer-s3');

var upload = multer({
storage: s3({
dirname: 'uploads/photos',
bucket: 'testing-bucket-yousa',
secretAccessKey: 'abcd',
accessKeyId: 'zz',
region: 'us-east-1'
})
})

app.post('/admin/uploadImagetoS3', upload.array('file'), function (req, res, next) {
console.log(res)
})

what does upload.array('file') do?

Please clarify me why is dirname required, I don’t want to store the data on my local machine and how to capture the response from s3, if it was successful or not?

pleerock commented 8 years ago

+1 for getting response

LinusU commented 8 years ago

dirname is the name of the "directory" on S3, not on your local machine.

upload.array('file') means that it will accept multiple files named "file".

LinusU commented 8 years ago

Please reopen if you need more assistance.