繁体   English   中英

烧瓶:通过帖子获取图像

[英]Flask: get image via post

嗨,我有以下HTML

<form action="classify_upload" method="post" id="upload-form">
    <input type="file" name="imagefile" id="imagefile"/>
    <input type="submit" />
  </form>

flask Webapp中,我有以下规则:

@webapp.route('/upload', methods=['POST'])
def upload():
    try:
        imagefile = flask.request.files('imagefile', '')
        ...
    except Exception as err:
        ...

但这给了我以下例外

'ImmutableMultiDict' object is not callable

我不知道这意味着什么或为什么发生。 有任何想法吗?

更改此行:

imagefile = flask.request.files('imagefile', '')

至:

imagefile = flask.request.files.get('imagefile', '')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM