2 回答
TA贡献1852条经验 获得超1个赞
1 2 3 4 5 6 | <form action="upload" method="post" enctype="multipart/form-data"> <input type="hidden" style="visibility: hidden;" name="formname" value="name0" /> <input type="hidden" style="visibility: hidden;" name="formid" value="0" /> <input type="file" name="file" /><br /> <input type="submit" value="Upload" /> </form> |
1 2 3 4 5 6 7 8 9 10 | @app.route('/upload', methods=['GET', 'POST']) def upload(): if request.method == 'GET': return render_template('upload.html') elif request.method == 'POST': f = request.files['file'] print request.form['formname'],request.form['formid'] fname = secure_filename(f.filename) f.save(os.path.join(UPLOAD_FOLDER, fname)) return '上传成功' |
添加回答
举报