'403 Forbidden error when i try to upload files using API Gateway

I am trying to upload files using API Gateway to S3 buckets. However when i try to upload txt files it returns HTTP Status 200 but when i try to upload PDF or PNG File format it returns 403 Forbidden. I added multipart/form-data as binary media type support in API settings and I have a WebAcl attached to this API. My open api specification is defined below:

requestBody:
  content:
    multipart/form-data:
      schema:
        properties:
          # The property name 'file' will be used for all files.
          file:
            type: array
            items:
              type: string
              format: binary


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source