Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS amplify adding files in public directory

I am using AWS amplify to upload video in s3 bucket when i am giving key in amplify options its creating a public folder and then taking that key.

Amplify.Storage.uploadFile(
            "user/hello/123321.mp4",
            exampleFile,
            result -> Log.i("MyAmplifyApp", "Successfully uploaded: " + result.getKey()),
            storageFailure -> Log.e("MyAmplifyApp", "Upload failed", storageFailure)
    );

s3 bucket its going inside - public/user/hello/123321.mp4

I just want my files to go in key and not create any public folder.

is there any option to do that ?

like image 425
Cycl0n3 Avatar asked Oct 18 '25 02:10

Cycl0n3


1 Answers

Try:

Storage.put(
"file name", 
file (actual file from input) ,
{
level: "public", 
customPrefix: {public: "folder name in S3 /"},
})
like image 61
Utsav Shrestha Avatar answered Oct 19 '25 22:10

Utsav Shrestha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!