@app.route("/upload-complete", methods=["POST"])
def handle_upload_response():
"""This will be called after every upload, but we can ignore it"""
return "Success"
@app.route("/upload", methods=["POST"])
def upload():
fp = request.files["name_of_file"]
url = create_upload_url(url_for('handle_upload_response'))
response = requests.post(url, {'file':
(fp.filename, fp.stream,
fp.content_type, fp.headers)})
if response == "Success":
return "File uploaded successfully"
else:
return "Something didn't work out"
看一下the docs for the BlobStore flow,您需要做的就是自己接受该文件,然后将其发送到
create_upload_url
指定的端点:相关问题 更多 >
编程相关推荐