python - Upload File with FlaskForm Render_form - Stack Overflow

I can succesfully Upload a file using:<form method="post" enctype="multipartform-dat

I can succesfully Upload a file using:

 <form method="post" enctype="multipart/form-data">.

However I can not combine this method with logging in my user.

I want to login my user using the render_form method:

{{ render_form(form, novalidate=True)}}

However, I can't find a way to support uploading a file with this method.

I can succesfully Upload a file using:

 <form method="post" enctype="multipart/form-data">.

However I can not combine this method with logging in my user.

I want to login my user using the render_form method:

{{ render_form(form, novalidate=True)}}

However, I can't find a way to support uploading a file with this method.

Share Improve this question edited Nov 16, 2024 at 22:47 Ahrimann Steiner 1,3441 gold badge11 silver badges31 bronze badges asked Nov 16, 2024 at 16:35 user23568016user23568016 53 bronze badges 1
  • {{ wtf.quick_form(form,enctype="multipart/form-data") }} – Ahrimann Steiner Commented Nov 16, 2024 at 21:03
Add a comment  | 

1 Answer 1

Reset to default 0
    {% macro render_form(form, action) %}
        {% from "_formhelpers.html" import render_field %}
        <div id="Product" class="variant-block" style="display: block;">
            {% from "_formhelpers.html" import render_field %}
            {% import "bootstrap/wtf.html" as wtf %}
            {{ wtf.quick_form(form,enctype="multipart/form-data")  }}
        </div>
    {% endmacro %}

More info. here: https://bootstrap-flask.readthedocs.io/en/stable/macros/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745651728a4638304.html

相关推荐

  • python - Upload File with FlaskForm Render_form - Stack Overflow

    I can succesfully Upload a file using:<form method="post" enctype="multipartform-dat

    3小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信