[Python] Flask not throwing wrong file format error [closed]

Discussão em 'Python' iniciado por Stack, Janeiro 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am creating a upload portal that allows users to upload a csv or text file. This is the code -

    {% extends "layout.html" %}

    {% block content %}
    <div class="content-section">
    <form method="POST" action="" enctype="multipart/form-data">
    {{ form.hidden_tag() }}
    <fieldset class="form-group">
    <legend class = "border-bottom mb-4">Login</legend>
    <div class="form-group">
    {{ form.delete_command.label(class="form-control-label") }}
    {{ form.delete_command(class="form-control form-control-lg") }}
    {% if form.delete_command.errors %}
    {% for error in form.delete_command.errors %}
    <span>{{ error }}</span></br>
    {% endfor %}
    {% endif %}
    </div>
    </fieldset>
    <div class="form-group">
    {{ form.submit(class="btn btn-outline-info") }}
    </div>
    </form>
    </div>
    {% endblock content %}


    My layout.html has this code block to display flash messages -

    {% with messages=get_flashed_messages(with_categories=true) %}
    {% if messages %}
    {% for category,message in messages %}
    <div class="alert alert-{{ category }}">
    {{ message }}
    </div>
    {% endfor %}
    {% endif %}
    {% endwith %}
    {% block content %}{% endblock %}


    What am I missing?

    Continue reading...

Compartilhe esta Página