From c9f0dd1ed6277ca234af61f62bef0f86697a6cea Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sun, 14 Sep 2008 10:32:04 +0000 Subject: [PATCH] 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 --- docs/topics/http/file-uploads.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/topics/http/file-uploads.txt b/docs/topics/http/file-uploads.txt index 24ff0eb205..bcf8b30409 100644 --- a/docs/topics/http/file-uploads.txt +++ b/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.