AWS Lambda Python 3 handle POST file

I’m working with Python 3.8 on AWS Lambda, and I would like to handle posted file, like requests.files with Django. But it’s impossible with AWS Lambda. I want to put this file in the S3 with :


When I return directly the received event, with the file :

I tried with cgi.parse_multipart; in my handler :

c_type, c_data = parse_header(event['headers']['Content-Type'])
boundary = c_data['boundary'].encode('latin1')
body = event['body'].encode('utf8')
fp = BytesIO(body)
pdict =<font color="navy">{</font> 'boundary': boundary,
    'CONTENT-LENGTH': str(len(body))
<font color="navy">}</font>form_data = parse_multipart(fp, pdict)
fileBytes: bytes = form_data['file'][0]
<font color="navy"><strong>return</strong></font>(<font color="navy">{</font>'statusCode': 200, 'file': json.dumps(str(fileBytes))<font color="navy">}</font>

I receive :

I also tried with


but I receive :

and I have always the “?”

I should get this, because it’s the original image, opened in edition :


Any idea ?