AWS S3 image upload from mobile
Unanswered
Capo posted this in #help-forum
CapoOP
The problem I'm having is on desktop I'm able to select an image and upload it just fine to S3 on desktop, but when it comes to uploading an image off a mobile device (taken live picture or selected from gallery) it will not upload to S3 due to error - "Type Error: Load Failed". I've tested this on dev and prod.
What I've tried so far to resolve -
1. Correctly Setting CORS Permissions in S3.
2. Tried using
3. automatically converting the uploaded image to jpeg format using sharp library to ensure a valid file type for s3.
4. Use API routes instead of Server Actions for handling uploading the image.
I'm not sure if anyone else is using s3 for images, if you are I'd like to see how you handle this.
What I've tried so far to resolve -
1. Correctly Setting CORS Permissions in S3.
2. Tried using
s3Client.send() instead of sending a put request using fetch library to the signed URL from s3.3. automatically converting the uploaded image to jpeg format using sharp library to ensure a valid file type for s3.
4. Use API routes instead of Server Actions for handling uploading the image.
I'm not sure if anyone else is using s3 for images, if you are I'd like to see how you handle this.
1 Reply
CapoOP
was able to solve this using
useFormState(serverAction, initialState)