Hello, everyone I have R2 bucket inside
Hello, everyone I have R2 bucket inside and i have two directories, i want to upload an image into the profile-pictures directory in the R2 bucket
I tried this but it only uploading into the main bucket, not inside the "profile-pictures" directory
let key = "profile-pictures/profilepic" + await generateToken(5)
await c.env.BC.put(key, payload.file);
I searched for 2 hours, but I couldn't find the documentation about that. Please help if you know the solution.
Thank you
4 Replies
please share any info about uploading in to the directory
directories don't exist, they're entirely virtual and only "exist" on list time where you can pass the delimiter you want to use. The dash by default lists objects with the
/
. You'd have to be more specific in what sense it's not workingto organize my assets i want to upload in to the directory but its not uploading in to the directory but uploading to the main bucket
let key = "./profile-pictures/profilepic" + await generateToken(5)
await c.env.BC.put(getKey, payload.file);