我遇到了使用瓶子批量图像上传的问题。 request.files.getall()返回空列表,即使我选择并上传文件。Bottle request.files.getall()返回空列表
我的形式看起来如下:
<form action="/upload" method="POST">
<div class="form-group">
<label for="gallery">Select images:</label>
<input id="gallery" type="file" name="gallery" accept=".gif,.jpg,.jpeg,.png" multiple>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
我的控制器看起来是这样的:
@route('/upload', method='POST')
def newGallery():
name = request.forms.get('name')
pictures = request.files.getall('gallery')
for picture in pictures:
print(picture.filename)
return template('new.html')
感谢您的帮助。
显示你的'new.html' –
那就是:HTTPS:/ /pastebin.com/3pw86VK1 – Sudet