aws / aws/chalice

multipart/form-data support in AWS Chalice

Open
#796 14 comments 4 reactions 0 assignees View on GitHub
feature-request
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Hello,

How would I parse the raw_body to get the filename and file content from "multipart/form-data" content-type request to PUT to S3?

When I tried the same with Flask, it has a request.files object property to extract the file content from the body:

```python
@app.route('/upload', methods=['POST'])
def upload():
try:
print request.__dict__
session = Session(aws_access_key_id='xxx',
aws_secret_access_key='xxxx',
region_name='xxx')
s3 = session.resource('s3')
s3.Bucket('my-bucket').put_object(Key='my-folder/mydata_file.pdf', Body=**request.files**['myfile'])
except Exception as e:
print str(e)
```

Does AWS Chalice supports multipart/form-data to get the file object like Flask (request.files)?

Or Is there another way to parse the raw_body?

Regards,
Pawan

Contributor guide

Open the contributing guide

Research direction

Start by reviewing AWS Chalice's handling of raw_body for API Gateway requests and the multipart/form-data behavior described in the issue. Compare the requested file extraction with Flask's request.files and S3 upload use case; done should mean a supported or clearly documented way to obtain the filename and file content.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
api, backend, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.