Closed ShabazAlex closed 5 years ago
I've fixed upload handling and modified the handling. Now when a file is uploaded you can access it via request.file or if multiple files are uploaded they will be in a list available from request.files.
I've also added this example code as examples/14_upload.py
from mrhttp import app
@app.route('/')
def hello(r):
if r.file == None:
return "No file uploaded"
#for f in r.files:
#print(f)
name = r.file['name']
typ = r.file['type']
body = r.file['body']
return name
app.run(cores=4)
# curl -i -X POST -F "data=@14_upload.py" http://localhost:8080/
curl -i -X POST -F "data=@tst.py" http://localhost:8080/
SystemError: <built-in method write of _io.TextIOWrapper object at 0x7f0be1ef0630> returned a result with an error set