-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 #10938
Comments
Hello @atef-abdellatif, thank you for opening this issue! This is very relevant to the APIs and Developer Experience for Storage. We are taking this into consideration for our roadmap and will update this issue on any progress. |
@atef-abdellatif Adding to the above, since Amplify Storage currently supports putting one object at a time with Ex: // Array of files that has the "key" and "content" attributes needed by Storage.put(key,content), reference at [1] below
const files = [
{key, content,...otherAttributes},
{key, content,...otherAttributes},
...
];
// wrapper for Storage.put that takes in each object from the array
const putWrapper = async (object) => {
try {
const res = await Storage.put(object.key,object.text,...additionalAttributes)
}catch(e){
console.error(e)
}
}
// handler that can be triggered to loop through the "files" array and invoke "putWrapper"
const handler = async () => {
for (let index = 0; index < files.length; index++) {
await putWrapper(files[index])
}
} [1] https://docs.amplify.aws/lib/storage/upload/q/platform/js/#upload-files |
Hi @atef-abdellatif Glad that the work around worked for you! Regarding your follow up questions, note that Amplify currently supports using one S3 bucket at a time - so multiple buckets would not work directly. However in order to store objects in sub folders, you can include a path with your key when running await Storage.put('documents/foo.txt','This is sample text') This would place the "foo.txt" file in the "public/documents/" folder. Additionally, I would recommend taking a look at the link at [1] below which discusses various access levels for public, private, and protected. [1] https://docs.amplify.aws/lib/storage/configureaccess/q/platform/js/ |
@atef-abdellatif The feature to upload images to specific buckets is now enable in Amplify v6( Does this close this feature request? I also see there is uploading multiple images to S3, the suggestion provided in this comment would be the best way to achieve that. Unfortunately S3 does not support batch upload. |
No description provided.
The text was updated successfully, but these errors were encountered: