1<input type="file" name="myImage" accept="image/x-png,image/gif,image/jpeg" />
1<form action="{% url 'submit' %}" method="POST" enctype="multipart/form-data">
2 {% csrf_token %}
3 <div class="mb-3">
4 <label for="formFile" class="form-label">Image</label>
5 <input class="form-control" type="file" id="formFile" name="image" accept="image/*">
6 </div>
7
8 <button class="btn btn-outline-info" type="submit">Submit</button>
9</form>
1<!-- Right approach: Use both file extensions and corresponding MIME-types. -->
2<!-- (IE 10+, Edge (EdgeHTML), Edge (Chromium), Chrome, Firefox) -->
3<input type="file"
4 accept=".xls,.xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" />