How to upload file to lambda function or API Gateway?

后端 未结 3 1303
甜味超标
甜味超标 2020-12-15 08:18

I\'m try to upload file from iOS to AWS API Gateway and passthrough it to Lambda function, How can I implement this scenario?

I can use multipart/form-data

3条回答
  •  天命终不由人
    2020-12-15 08:47

    If want to upload file through lambda, one way is to open your AWS API Gateway console.

    Go to

    "API" -> {YourAPI} -> "Settings"

    There you will find "Binary Media Types" section.

    Add following media type:

    multipart/form-data

    Save your changes.

    Then Go to "Resources" -> "proxy method"(eg. "ANY") -> "Method Request" -> "HTTP Request Headers" and add following headers "Content-Type", "Accept".

    Finally deploy your api.

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

提交回复
热议问题