#26604: Add example of simple multiple file upload in documentation
-------------------------+-------------------------------------------------
     Reporter:  zxcq544  |      Owner:  nobody
         Type:  New      |     Status:  new
  feature                |
    Component:           |    Version:  1.9
  Documentation          |   Keywords:  doumentation, multiple file upload,
     Severity:  Normal   |  upload many files
 Triage Stage:           |  Has patch:  0
  Unreviewed             |
Easy pickings:  0        |      UI/UX:  0
-------------------------+-------------------------------------------------
 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>
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26604>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.197d703c8df161dc446f3ead31b145dc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to