#26604 closed New feature (fixed)
Add example of simple multiple file upload in documentation
Description ¶
At https://docs.djangoproject.com/en/1.9/topics/http/file-uploads/ we could add simple example of multiple file upload:
In views.py
def handle_uploaded_files(files): for i in files: with open('uploads/' + i.name, 'wb+') as destination: for chunk in i.chunks(): destination.write(chunk) def upload_file(request): if request.method == 'POST': handle_uploaded_files(request.FILES.getlist('files[]')) return render(request, 'upload.html')
In upload.html
<form method="post" enctype="multipart/form-data"> {% csrf_token %} <input type="file" name="files[]" multiple> <input type="submit" value="Send"> </form>
Change History (7)
comment:1 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 9 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 9 years ago
Patch needs improvement: | set |
---|
comment:4 by , 9 years ago
Patch needs improvement: | unset |
---|
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/6603