Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. @app.route("/upload/<filename>", methods=["POST", "PUT"])
  2. def upload_process(filename):
  3. filename = secure_filename(filename)
  4. fileFullPath = os.path.join(application.config['UPLOAD_FOLDER'], filename)
  5. with open(fileFullPath, "wb") as f:
  6. chunk_size = 4096
  7. while True:
  8. chunk = flask.request.stream.read(chunk_size)
  9. if len(chunk) == 0:
  10. return
  11.  
  12. f.write(chunk)
  13. return jsonify({'filename': filename})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement