I have a React project using aws-amplify version 6.1.4
I want to put my file in the “private” directory. However, my file by default is put into the “public” directory. After looking through the official Amplify documentation, which wasn’t at all helpful I ended up coming across some repos and stackoverflow questions that suggested adding
options: { accessLevel: 'private' }
to my uploadData request. However, after adding it, it doesn’t upload to either the private or public directory. No upload at all event though there is no error given in the console.log(result). Once I remove accessLevel: ‘private’ it reverts back to uploading the files in the public directory.
Here’s a sample of my request with the added accessLevel: ‘private’,
const result = await uploadData({
key,
data: blob,
options: {
accessLevel: 'private',
contentType,
metadata: {
environment: process.env.NODE_ENV,
resourceId: photoResult.data.id,
resourceType: resourceTypes.PHOTO
},
onProgress: ({ transferredBytes, totalBytes }) => {
console.log(`Uploading photo: ${transferredBytes}/${totalBytes}`);
}
}
}).result;
console.log("Upload result:", result);
Anyone have any ideas why this isn’t working (no upload at all) and why there are no errors?