Python 类型错误:存储必须是werkzeug.FileStorage

Python 类型错误:存储必须是werkzeug.FileStorage,python,flask,werkzeug,file-storage,Python,Flask,Werkzeug,File Storage,我正在尝试在Flask应用程序的文件系统中保存图像。它很好用。我可以上传照片并检索它们。但当我单击Submit而不选择任何图像时,它会给我一个错误: 类型错误:存储必须是werkzeug.files存储 请帮忙 我没有什么经验,所以我在这里很不自在。错误来自flask_uploads.py: def保存(自我、存储、文件夹=无、名称=无): """ 这会将werkzeug.FileStorage保存到此上载集中。如果 不允许上载,将引发UploadNotAllowed错误。 否则,将保存文件及其

我正在尝试在Flask应用程序的文件系统中保存图像。它很好用。我可以上传照片并检索它们。但当我单击Submit而不选择任何图像时,它会给我一个错误:

类型错误:存储必须是werkzeug.files存储

请帮忙

我没有什么经验,所以我在这里很不自在。错误来自flask_uploads.py:

def保存(自我、存储、文件夹=无、名称=无): """ 这会将
werkzeug.FileStorage
保存到此上载集中。如果 不允许上载,将引发
UploadNotAllowed
错误。 否则,将保存文件及其名称(包括文件夹) 将被退回

从flask_uploads import UploadSet,配置_uploads、图像

表格=添加***()

如果没有选择图像,我希望html返回页面

    :param storage: The uploaded file to save.
    :param folder: The subfolder within the upload set to save to.
    :param name: The name to save the file as. If it ends with a dot, the
                 file's extension will be appended to the end. (If you
                 are using `name`, you can include the folder in the
                 `name` instead of explicitly using `folder`, i.e.
                 ``uset.save(file, name="someguy/photo_123.")``
    """
    if not isinstance(storage, FileStorage):
        raise TypeError("storage must be a werkzeug.FileStorage")
if form.validate_on_submit():
    image_url = photos.url(photos.save(form.image.data))  
    new_**** = ****(screenname= form.screenname.data, fullname = form.fullname.data, team = form.team.data, image=image_url)


db.session.add(new_****)
    db.session.commit()
    flash("Added Successfully")
    return redirect (url_for('****'))

return render_template("****.html", form=form)