Commit c9f0dd1e authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Fixed #9075: Added a call to close() in the example file upload handler....

Fixed #9075: Added a call to close() in the example file upload handler. Thanks to Brendan (bmsleight) for the suggestion.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent ea0fe604
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ Putting it all together, here's a common way you might handle an uploaded file::
        destination = open('some/file/name.txt', 'wb+')
        for chunk in f.chunks():
            destination.write(chunk)
        destination.close()

Looping over ``UploadedFile.chunks()`` instead of using ``read()`` ensures that
large files don't overwhelm your system's memory.