title: upload multiple files in django
body: <p>I am new to django, I am trying to upload more than one file from the browser and store them somewhere in computer storage but I am not storing them successfully with this code please help me out to find my mistake or improvements that I can do. Thanks in advance to help.</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>    from django.shortcuts import render
      from django.http import HttpResponse
      # Create your views here.
  
      def Form(request):
          return render(request, "index/form.html", {})
  
      def Upload(request):
          for count, x in enumerate(request.FILES.getlist("files")):
              def process(f):
                  with open('/Users/benq/djangogirls/upload/media/file_' + str(count), 'wb+') as destination:
                      for chunk in f.chunks():
                          destination.write(chunk) 
              process(x)
          return HttpResponse("File(s) uploaded!")
  </code></pre>
  
  <p><strong>app/urls.py</strong></p>
  
  <pre><code>from django.conf.urls import url
  from index import views
  
  urlpatterns = [
      url(r'^form/$', views.Form),
      url(r'^upload/$', views.Upload)
  ]
  </code></pre>
  
  <p><strong>form.html</strong></p>
  
  <pre><code>&lt;form method="post" action="../upload/" entype="multipart/form-data"&gt; {% csrf_token %}
  &lt;input type="file" name="files" multiple /&gt;
  &lt;input type="submit" value="Upload" /&gt;
  </code></pre>
  
  <p></p>