Index: django/http/multipartparser.py
===================================================================
--- django/http/multipartparser.py	(revision 7857)
+++ django/http/multipartparser.py	(working copy)
@@ -136,6 +136,7 @@
                     # since we cannot be sure a file is complete until
                     # we hit the next boundary/part of the multipart content.
                     self.handle_file_complete(old_field_name, counters)
+                    old_field_name = None
 
                 try:
                     disposition = meta_data['content-disposition'][1]
Index: django/test/client.py
===================================================================
--- django/test/client.py	(revision 7857)
+++ django/test/client.py	(working copy)
@@ -90,32 +90,38 @@
     """
     lines = []
     to_str = lambda s: smart_str(s, settings.DEFAULT_CHARSET)
-    for (key, value) in data.items():
-        if isinstance(value, file):
-            lines.extend([
+
+    def encode_file(key, value):
+        lines.extend([
                 '--' + boundary,
                 'Content-Disposition: form-data; name="%s"; filename="%s"' \
                     % (to_str(key), to_str(os.path.basename(value.name))),
                 'Content-Type: application/octet-stream',
                 '',
                 value.read()
-            ])
+                ])
+
+    for (key, value) in data.items():
+        if isinstance(value, file):
+            encode_file(key, value)
+        elif not isinstance(value, basestring) and is_iterable(value):
+            for item in value:
+                if isinstance(item, file):
+                    encode_file(key, item)
+                else:
+                    lines.extend([
+                            '--' + boundary,
+                            'Content-Disposition: form-data; name="%s"' % to_str(key),
+                            '',
+                            to_str(item)
+                            ])
         else:
-            if not isinstance(value, basestring) and is_iterable(value):
-                for item in value:
-                    lines.extend([
-                        '--' + boundary,
-                        'Content-Disposition: form-data; name="%s"' % to_str(key),
-                        '',
-                        to_str(item)
-                    ])
-            else:
-                lines.extend([
+            lines.extend([
                     '--' + boundary,
                     'Content-Disposition: form-data; name="%s"' % to_str(key),
                     '',
                     to_str(value)
-                ])
+                    ])
 
     lines.extend([
         '--' + boundary + '--',
Index: tests/regressiontests/file_uploads/views.py
===================================================================
--- tests/regressiontests/file_uploads/views.py	(revision 7857)
+++ tests/regressiontests/file_uploads/views.py	(working copy)
@@ -67,4 +67,14 @@
     """
     response = file_upload_echo(request)
     request.upload_handlers.insert(0, QuotaUploadHandler())
-    return response
\ No newline at end of file
+    return response
+
+def file_upload_getlist_count(request):
+    """
+    Check the .getlist() function to ensure we receive the correct number of files.
+    """
+    file_counts = {}
+
+    for key in request.FILES.keys():
+        file_counts[key] = len(request.FILES.getlist(key))
+    return HttpResponse(simplejson.dumps(file_counts))
Index: tests/regressiontests/file_uploads/tests.py
===================================================================
--- tests/regressiontests/file_uploads/tests.py	(revision 7857)
+++ tests/regressiontests/file_uploads/tests.py	(working copy)
@@ -147,12 +147,34 @@
     def test_broken_custom_upload_handler(self):
         f = tempfile.NamedTemporaryFile()
         f.write('a' * (2 ** 21))
-        
+
         # AttributeError: You cannot alter upload handlers after the upload has been processed.
         self.assertRaises(
             AttributeError,
             self.client.post,
-            '/file_uploads/quota/broken/', 
+            '/file_uploads/quota/broken/',
             {'f': open(f.name)}
-        )        
-        
\ No newline at end of file
+        )
+
+    def test_fileupload_getlist(self):
+        file1 = tempfile.NamedTemporaryFile()
+        file1.write('a' * (2 ** 23))
+
+        file2 = tempfile.NamedTemporaryFile()
+        file2.write('a' * (2 * 2 ** 18))
+
+        file2a = tempfile.NamedTemporaryFile()
+        file2a.write('a' * (5 * 2 ** 20))
+
+        response = self.client.post('/file_uploads/getlist_count/', {
+                'file1': open(file1.name),
+                'field1': u'test',
+                'field2': u'test3',
+                'field3': u'test5',
+                'field4': u'test6',
+                'field5': u'test7',
+                'file2': (open(file2.name), open(file2a.name))
+                })
+        got = simplejson.loads(response.content)
+
+        self.assert_(got.get('file1', 0) == 1 and got.get('file2', 0) == 2)
Index: tests/regressiontests/file_uploads/urls.py
===================================================================
--- tests/regressiontests/file_uploads/urls.py	(revision 7857)
+++ tests/regressiontests/file_uploads/urls.py	(working copy)
@@ -7,4 +7,5 @@
     (r'^echo/$',            views.file_upload_echo),
     (r'^quota/$',           views.file_upload_quota),
     (r'^quota/broken/$',    views.file_upload_quota_broken),
+    (r'^getlist_count/$',   views.file_upload_getlist_count),
 )
