Presigned URL set acl?

I have a presigned url logic which uploads files successfully to my s3 bucket, but right now I can't view those files, I am getting an acl Access denied error. I am wondering how I can set that policy in my presigned url logic so far I did this without success:
const conditions = [{ acl: 'public-read' }, ['content-length-range', 0, 10485760]];

const result = <PresignedPostOutput>this.s3.createPresignedPost({
Bucket: this.s3Bucket,
Fields: {
key: uniqueName,
'Content-Type': filetype,
},
Expires: 60 * 5,
Conditions: conditions,
});
const conditions = [{ acl: 'public-read' }, ['content-length-range', 0, 10485760]];

const result = <PresignedPostOutput>this.s3.createPresignedPost({
Bucket: this.s3Bucket,
Fields: {
key: uniqueName,
'Content-Type': filetype,
},
Expires: 60 * 5,
Conditions: conditions,
});
Frontend
const formData = new FormData();

Object.entries({ ...fields, file }).forEach(([key, value]) => {
formData.append(key, value as string);
});

const upload = await fetch(url, {
method: 'POST',
body: formData,
});

if (upload.ok) {
const formData = new FormData();

Object.entries({ ...fields, file }).forEach(([key, value]) => {
formData.append(key, value as string);
});

const upload = await fetch(url, {
method: 'POST',
body: formData,
});

if (upload.ok) {
1 Reply
utdev
utdev2y ago
not sure if it is enough to just add acl to the conditions array, also not sure if I need to update something in my aws settings
Want results from more Discord servers?
Add your server