1

How and what’s to be configured in API gateway to accept file as an input in AJAX call. Also How to read the contents of the file in Python Lambda? There ain't much help with examples available in the official aws docs

1
  • I want to upload a doc/docx file from the client and then parse and convert into JSON data and return it back to the client Commented Feb 20, 2018 at 11:12

1 Answer 1

1

We need to zip the dependencies along with python file and upload it.

For example if you wish to read a file called input.conf in python file reader.py, you need to create a zip file which includes the above files within it.

/uploader.zip
  |- input.conf
  | - reader.py

The name of the python file should be the first part of lambda handler, like: reader.lambda_handler (in case of python)

Sign up to request clarification or add additional context in comments.

6 Comments

I want to upload the file from the browser and user's gonna provide this file.
In that case, you need to read the file as bytes (for binary file) or string and add it to request body which will be passed to api gateway.
File cannot be passed directly to api gateway (REST accepts payload only as string in json or xml). You should be reading the file from client side and sent it to server as string in the request payload
That's my exact question on how to do that?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.