Skip to content

Commit

Permalink
Fixed #12955 -- Use the size attribute of the file instead of len() t…
Browse files Browse the repository at this point in the history
…o support uploads larger than 2GB. Thanks, swiedenroth and isagalaev.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jezdez committed Dec 12, 2010
1 parent 6261593 commit 88ff656
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django/db/models/fields/files.py
Expand Up @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 88ff656

Please sign in to comment.