Skip to content
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

Storage.put() method adds 'public/' prefix to key #396

Closed
ildar-icoosoft opened this issue Mar 2, 2018 · 5 comments
Closed

Storage.put() method adds 'public/' prefix to key #396

ildar-icoosoft opened this issue Mar 2, 2018 · 5 comments

Comments

@ildar-icoosoft
Copy link

Do you want to request a feature or report a bug? bug

What is the current behavior?

I'm trying to upload file to S3. Here is my code:
Storage.put('aaa', body, {})
aws-amplify transforms the key to 'public/aaa'

What is the expected behavior?
aws-cmplify should not change the Key

Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions? aws-amplify 0.2.7

@mlabieniec
Copy link
Contributor

Duplicate of #332 we are working on making this configurable. Currently it places the configured permission level as the prefix i.e. public/private

@Shuvo-Hoque
Copy link

Try it this way :

await Storage.put(filename, file, {
contentType: 'application/pdf',
customPrefix: {
public:''
}
}).then(result => {
console.log(result)
}).catch(err => {
console.log(err)
alert(Can't upload file: ${err})
});

filename : this is the s3_key of your file. so when you'll upload the file, the file will be saved in S3 bucket in this name.

@Shuvo-Hoque
Copy link

Found a way to do this,

let result = await Storage.put('folderName/imageName.png', blob, {
contentType: 'image/jpeg',
customPrefix: {
public:''
}
});
This saves the file in the root of the bucket, inside folder "folderName".

@SomnathS09
Copy link

what about downloading then, Storage.list() returns empty array and if files are placed in "public" named directory then it returns the files

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants