Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.2.X] Fixed #12955 -- Use the size attribute of the file instead of…

… len() to support uploads larger than 2GB. Thanks, swiedenroth and isagalaev.

Backport from trunk (r14878).

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14903 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d6cf84b032538eb7edb60b353ab1c60973a7b7f5 1 parent 38d848a
@jezdez jezdez authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/db/models/fields/files.py
View
4 django/db/models/fields/files.py
@@ -73,7 +73,7 @@ def _get_url(self):
def _get_size(self):
self._require_file()
if not self._committed:
- return len(self.file)
+ return self.file.size
return self.storage.size(self.name)
size = property(_get_size)
@@ -93,7 +93,7 @@ def save(self, name, content, save=True):
setattr(self.instance, self.field.name, self.name)
# Update the filesize cache
- self._size = len(content)
+ self._size = content.size
self._committed = True
# Save the object because it has changed, unless save is False
Please sign in to comment.
Something went wrong with that request. Please try again.