search

Home  >  Q&A  >  body text

python - django无法上传文件?

大家讲道理大家讲道理2911 days ago339

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:01:34

    If you need to upload files, you need to specify the enctype="multipart/form-data" attribute in the form and change the form to:

    <form action="{% url 'backend:upload' %}" method="post" enctype="multipart/form-data">
        {% csrf_token %}
        {{ form }}
        <button type="submit">Submit</button>
    </form>

    Please read the document content carefully, it mentions this.

    reply
    0
  • Cancelreply