I'm making a serverless laravel application, and i need to be able to upload images to S3 via form. I tested locally and it uploads and retrieves the image just fine from S3, but when i try the same code in my serverless application, the uploaded file in S3 arrives corrupted.
That's the code i'm using to upload the images:
I tried uploading other types of files, but all of them arrive corrupted in S3, except for txt.
I already searched a lot and couldn't understand the reason of this.
Just found the solution for my problem. I had to go to API Gateway, and under Settings add the media binary type multipart/form-data, save and redeploy the API. After that the upload worked!
Yes it works thanks.
Most helpful comment
Just found the solution for my problem. I had to go to API Gateway, and under Settings add the media binary type multipart/form-data, save and redeploy the API. After that the upload worked!