OVERVIEW:
I'm using S3 to let users upload images.
I'm working on an update route using a PUT
method, which takes the url of a given image stored on a temp folder in S3
bucket and removes it to an images folder.
here is my upload object:
const upload = multer({
storage: multerS3({
s3: s3,
bucket: 'my-bucket',
contentType: multerS3.AUTO_CONTENT_TYPE,
acl: 'public-read',
key: function (request, file, cb) {
cb(null, folder + Date.now() + file.originalname);
}
}),
limits:{
fileSize: 1024 * 1024 * 5
},
fileFilter:fileFilter
});
and in the route file i'm using:
upload.single('the_key_of_the_file')
PROBLEM:
this object works when uploading a new file, however not for updating it (renaming the file).