Skip to content
Advertisement

Image and PDF files getting corrupted while uploading on AWS S3

I am trying to upload images and PDF on AWS S3 using my Spring Boot app. They are getting uploaded in corrupt format without any error. Text files are uploaded successfully.

JavaScript

Below is the dependencies we have used.

JavaScript

Advertisement

Answer

My code works fine. The issue was in the AWS API Gateway. We need to add '*/*' in the Binary Media Types to make file uploading work.

For Reference: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings-configure-with-console.html

Advertisement