upload.html:
<html>
<body>
<form action=upload_file_form method="post">
<input type="file" name="file"></br>
<input type="submit" value="Send">
</form>
</body>
</html>
主程式.py:
UPLOAD_FOLDER='/home/bernie/flask_web_demaon/ovpn_files'
@app.route("/upload_file_form",methods=['GET','POST'])
def upload_file_form():
import os
file = request.files['file']
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'],filename))
return send_from_directory('static/report/flexmonkey/html','upload.html'
就可以了,谢谢。