Guest User

Untitled

a guest
Feb 22nd, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. @app.route("/upload", methods=['POST'])
  2. async def omo(request):
  3. from sanic import response
  4. import os
  5. if not os.path.exists(appConfig["upload"]):
  6. os.makedirs(appConfig["upload"])
  7.  
  8. f = open(appConfig["upload"]+"/"+request.files["file"][0].name,"wb")
  9. f.write(request.files["file"][0].body)
  10. f.close()
  11.  
  12. return response.json(True)
Add Comment
Please, Sign In to add comment