Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from quart import Quart, request, send_from_directory
- app = Quart(__name__)
- def stream_to_file(stream, filename):
- with open(filename, 'wb') as f:
- for chunk in stream:
- f.write(chunk)
- @app.route('/upload', methods=['POST'])
- async def upload_file(**kwargs):
- files = await request.files
- files = dict(files)
- for key in files.keys():
- file = files[key]
- stream_to_file(file.stream, file.filename)
- return 'success', 200
- if __name__ == "__main__":
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement