Okay okay. Perhaps I figured, but you can correct me here.
If I am to upload a file to a folder that does not yet exist, the code should look like this
const params = {
Bucket: "ctp-portal-dev",
Key: "users/" + file.name,
Body: file.data,
ACL: "public-read"
};
// Uploading files to the bucket
s3.upload(params, function(err, data) {
if (err) {
console.log(err.message)
throw err;
}
console.log(`File uploaded successfully. ${data.key} ${data.Key} ${data.ETag}`);
console.log(Object.keys(data))
});
If I am to upload a file to a folder that does not yet exist, the code should look like this
const params = {
Bucket: "ctp-portal-dev",
Key: "users/" + file.name,
Body: file.data,
ACL: "public-read"
};
// Uploading files to the bucket
s3.upload(params, function(err, data) {
if (err) {
console.log(err.message)
throw err;
}
console.log(`File uploaded successfully. ${data.key} ${data.Key} ${data.ETag}`);
console.log(Object.keys(data))
});