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
This commit is contained in:
Russell Keith-Magee 2008-09-14 10:32:04 +00:00
parent ea0fe604d8
commit c9f0dd1ed6
1 changed files with 1 additions and 0 deletions

View File

@ -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.