def processImages(request):
    method = request.method.decode('utf-8').upper()
content_type = request.getHeader('content-type')
img = FieldStorage(fp=request.content, headers=request.getAllHeaders(),
    environ={'REQUEST_METHOD': method, 'CONTENT_TYPE': content_type})
name = secure_filename(img['datafile'].filename)
with open(name, 'wb') as fileOutput:
    fileOutput.write(request.args['datafile'][0])
app.run('localhost', 8000)
How to receive uploaded file with Klein like Flask in python