The HTML form enctype attribute chooses how submitted form data is encoded. For file uploads, set enctype="multipart/form-data"; otherwise the selected file will not reach the server, creating a particularly sneaky bug. section 7.4.3
Uploading a venue picture
A venue form can submit its name, description, and picture with <form enctype="multipart/form-data" method="post">. The Django view then binds request.POST and request.FILES to the form, allowing the uploaded picture to be saved with the Venue. section 7.4.3
Listing 7.19 Template for adding or editing a Venue object
<!-- RiffMates/templates/edit_venue.html -->
{% extends "base.html" %}
{% block content %}
<h1>Venue Details</h1>
<form enctype="multipart/form-data" method="post"> #1
{% csrf_token %}
{{form.as_p}}
<button class="btn btn-dark" type="submit">Save</button>
</form>
{% endblock content %}
See the complete form markup, including multipart encoding, CSRF protection, rendered fields, and the Save button. section 7.4.3
