Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…er. Thanks to Brendan (bmsleight) for the suggestion.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c9f0dd1ed6277ca234af61f62bef0f86697a6cea 1 parent ea0fe60
@freakboy3742 freakboy3742 authored
Showing with 1 addition and 0 deletions.
  1. +1 −0  docs/topics/http/file-uploads.txt
View
1  docs/topics/http/file-uploads.txt
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.