flask code
@app.route('/usecase/get/excel/<heads>', methods=['GET', 'POST'])
def get_excel(heads):
headers = {"Content-Disposition": "attachment; filename=%s" % "usecase.xls"}
with open("usecase.xls", 'r') as f:
body = f.read()
return Response(response=(body, headers))
html code
<form action="/template/usecase/get/excel/" method="post">
<button type="submit" class="btn btn-info">download</button>
</form>
if click download button, error occured "Method not allowed".. and how to download server's file? this is exactly program?
Aucun commentaire:
Enregistrer un commentaire