HTML如何构造表单组和引导类以捕获单个表单数据,传递给Python
借助python flask脚本,我的html页面上有一个“GET”/“POST”拆分:HTML如何构造表单组和引导类以捕获单个表单数据,传递给Python,html,twitter-bootstrap,forms,post,flask,Html,Twitter Bootstrap,Forms,Post,Flask,借助python flask脚本,我的html页面上有一个“GET”/“POST”拆分: def home(name=None): if request.method == "GET": return render_template('home.html', name=name) if request.method == "POST": files = request.form["file[]"] do things with the files 在我的home.htm
def home(name=None):
if request.method == "GET":
return render_template('home.html', name=name)
if request.method == "POST":
files = request.form["file[]"]
do things with the files
在我的home.html页面上,我添加了一些引导代码,使一切都变得漂亮,但是flask模块现在没有正确地接收表单数据。以下是我的html代码:
<form id="uploadbanner" enctype="multipart/form-data" method="post" action="{{ url_for('home') }}">
<div class="form-group">
<div class="container">
<div class="page-header">
<br>
<h1>Title</h1>
<br>
<br>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-s-6 col-xs-12">
<h4>File Control</h4>
<div class="jumbotron">
And my form data is here:
<input type="file" name="file[]" id="inputnameid" multiple=""/>
</div>
</div>
Second Column
</div>
New Row, etc etc
标题
文件控制
我的表格数据如下:
第二列
新的一排等
每一新行都有我希望使用名称字段与表单数据匹配的按钮和输入。我知道我没有正确地构造它,但是我似乎找不到任何关于如何将引导和表单网格化的信息。我认为为了获取文件,你应该使用
request.files[“file[]”]
而不是request.form[“file[]”]
我认为为了获取文件,你应该使用request.files[“file[]”
而不是请求.form[“file[]”]