Hi Wes,
Your API that returns the policy JSON has a minor bug in date formatting.
For example
curl --location --request PUT 'https://fffs.absurd.chat/generate-file-urls' \
--header 'Content-Type: application/json' \
--data-raw '{
"bucket": "public.fffs.absurd.chat",
"objectKey": "guests/diotest/1715231651044"
}'
returns base64 encoded policy
eyJjb25kaXRpb25zIjpbWyJlcSIsIiRrZXkiLCJndWVzdHMvZGlvdGVzdC8xNzE1MjMxNjUxMDQ0Il0sWyJlcSIsIiRidWNrZXQiLCJwdWJsaWMuZmZmcy5hYnN1cmQuY2hhdCJdLFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMjA5NzE1MjAwXSxbImVxIiwiJHgtYW16LWRhdGUiLCIyMDI0MDUwOVQwNTE0MTFaIl0sWyJlcSIsIiR4LWFtei1hbGdvcml0aG0iLCJBV1M0LUhNQUMtU0hBMjU2Il0sWyJlcSIsIiR4LWFtei1jcmVkZW50aWFsIiwidGlkX0V1TWhMemJxbUZBWVZzcmNrSXp2S3ZPeFpaa0VtWVNWYmVyVkdJYWtRcWFGd0FRSHFXLzIwMjQwNTA5L2F1dG8vczMvYXdzNF9yZXF1ZXN0Il1dLCJleHBpcmF0aW9uIjoiMjAyNC0wNS0xMVQwNToxNDoxMS44NzE4OTIifQ==
Which renders to (formatted) JSON as follows
{
"conditions": [
[
"eq",
"$key",
"guests/diotest/1715231651044"
],
[
"eq",
"$bucket",
"public.fffs.absurd.chat"
],
[
"content-length-range",
0,
209715200
],
[
"eq",
"$x-amz-date",
"20240509T051411Z"
],
[
"eq",
"$x-amz-algorithm",
"AWS4-HMAC-SHA256"
],
[
"eq",
"$x-amz-credential",
"tid_EuMhLzbqmFAYVsrckIzvKvOxZZkEmYSVberVGIakQqaFwAQHqW/20240509/auto/s3/aws4_request"
]
],
"expiration": "2024-05-11T05:14:11.871892"
}
The expiration
field value needs fixing by converting it to
2024-05-11T05:14:11.871892Z
Note that you need to recompute signature with this change. With these two changes.
The base64 encoded policy looks like this
eyJjb25kaXRpb25zIjpbWyJlcSIsIiRrZXkiLCJndWVzdHMvZGlvdGVzdC8xNzE1MjMxNjUxMDQ0Il0sWyJlcSIsIiRidWNrZXQiLCJwdWJsaWMuZmZmcy5hYnN1cmQuY2hhdCJdLFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMjA5NzE1MjAwXSxbImVxIiwiJHgtYW16LWRhdGUiLCIyMDI0MDUwOVQwNTE0MTFaIl0sWyJlcSIsIiR4LWFtei1hbGdvcml0aG0iLCJBV1M0LUhNQUMtU0hBMjU2Il0sWyJlcSIsIiR4LWFtei1jcmVkZW50aWFsIiwidGlkX0V1TWhMemJxbUZBWVZzcmNrSXp2S3ZPeFpaa0VtWVNWYmVyVkdJYWtRcWFGd0FRSHFXLzIwMjQwNTA5L2F1dG8vczMvYXdzNF9yZXF1ZXN0Il1dLCJleHBpcmF0aW9uIjoiMjAyNC0wNS0xMVQwNToxNDoxMS44NzE4OTJaIn0=
and computed signature for your credentials, using these I created HTML form. If you need me to pass the sensitive information such as signature to you, please write us at help@tigrisdata.com or you can compute signature yourself.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="https://fly.storage.tigris.dev/public.fffs.absurd.chat"
method="post"
enctype="multipart/form-data">
Key to upload:
<input type="input" name="key" value="guests/diotest/1715231651044" /><br />
<input type="hidden" name="success_action_redirect" value="https://your-website.com/success.html" />
Content-Type:
<input type="input" name="Content-Type" value="image/jpeg" /><br />
<input type="text" name="X-Amz-Credential" value="tid_EuMhLzbqmFAYVsrckIzvKvOxZZkEmYSVberVGIakQqaFwAQHqW/20240509/auto/s3/aws4_request" />
<input type="text" name="X-Amz-Algorithm" value="AWS4-HMAC-SHA256" />
<input type="text" name="X-Amz-Date" value="20240509T051411Z" />
Tags for File:
<input type="hidden" name="Policy" value='eyJjb25kaXRpb25zIjpbWyJlcSIsIiRrZXkiLCJndWVzdHMvZGlvdGVzdC8xNzE1MjMxNjUxMDQ0Il0sWyJlcSIsIiRidWNrZXQiLCJwdWJsaWMuZmZmcy5hYnN1cmQuY2hhdCJdLFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMjA5NzE1MjAwXSxbImVxIiwiJHgtYW16LWRhdGUiLCIyMDI0MDUwOVQwNTE0MTFaIl0sWyJlcSIsIiR4LWFtei1hbGdvcml0aG0iLCJBV1M0LUhNQUMtU0hBMjU2Il0sWyJlcSIsIiR4LWFtei1jcmVkZW50aWFsIiwidGlkX0V1TWhMemJxbUZBWVZzcmNrSXp2S3ZPeFpaa0VtWVNWYmVyVkdJYWtRcWFGd0FRSHFXLzIwMjQwNTA5L2F1dG8vczMvYXdzNF9yZXF1ZXN0Il1dLCJleHBpcmF0aW9uIjoiMjAyNC0wNS0xMVQwNToxNDoxMS44NzE4OTJaIn0=' />
<input type="hidden" name="X-Amz-Signature" value="HIDDEN" />
File:
<input type="file" name="file" /> <br />
<input type="submit" name="submit" value="Upload to Amazon S3" />
</form>
</html>
I uploaded https://fly.storage.tigris.dev/public.fffs.absurd.chat/guests/diotest/1715231651044 this using this form to your bucket.
Please let us know if this resolves your issue or if you have additional questions.
Thanks
Jigar