#✅ - Help with File Upload Using New Access Patterns in Amplify Gen2

4 messages · Page 1 of 1 (latest)

sly axle
#

Hello, everyone!

I'm currently working on integrating AWS Amplify's storage capabilities into my project and have come across a bit of confusion regarding the transition from Gen1 to Gen2 documentation, specifically around file uploads with new access patterns.

In the Amplify Gen2 documentation under the storage section (https://docs.amplify.aws/gen2/build-a-backend/storage/), there are details on access patterns for authenticated users, guests, groups, and owners. However, when it comes to the practical implementation of uploading and downloading files, the documentation redirects to Gen1 pages (https://docs.amplify.aws/javascript/build-a-backend/storage/upload/).

The Gen1 documentation discusses accessLevel options like guest, public, and private, which lead to the automatic creation of public, protected, and private folders. But, it doesn't clarify how to upload directly to a specified path (e.g., '/foo/*') without defaulting to these public or private folders under the new access patterns.

I'm trying to understand how to implement file uploads that align with Gen2's more flexible access controls without reverting to the Gen1 folder structure. Has anyone tackled this issue or found documentation or examples that clarify this process? Any insights or guidance would be greatly appreciated!

Thank you in advance for your help!

violet hare
#

hey on your frontend app you would need to use the path for your custom paths for example where i have a path called media

 const result = await uploadData({
        path: `media/<file-name>`,
        data: file,
        options: {
          contentType: "image/jpg", // contentType is optional
        },
      }).result;
lavish tendon
prisma kelpBOT
#

✅ - Help with File Upload Using New Access Patterns in Amplify Gen2