await s3
.upload({
Bucket: paths({ id: req.user._id, ct: fields?.ct }),
ACL: 'public-read',
Key: key,
Body: body,
ContentType: contentType,
})
.send((err, data) => {
if (err) {
return res.status(500).json('Internal Error Please try again');
}
if (data) {
console.log('data', data);
return res.status(200).json({ files: data.Location });
}
});
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
full code here
(is this approach good ) :