mirror of
https://github.com/django/django.git
synced 2024-12-26 02:56:25 +00:00
Fixed #12955 -- Use the size attribute of the file instead of len() to 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
This commit is contained in:
parent
6261593b99
commit
88ff656731
@ -73,7 +73,7 @@ class FieldFile(File):
|
|||||||
def _get_size(self):
|
def _get_size(self):
|
||||||
self._require_file()
|
self._require_file()
|
||||||
if not self._committed:
|
if not self._committed:
|
||||||
return len(self.file)
|
return self.file.size
|
||||||
return self.storage.size(self.name)
|
return self.storage.size(self.name)
|
||||||
size = property(_get_size)
|
size = property(_get_size)
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class FieldFile(File):
|
|||||||
setattr(self.instance, self.field.name, self.name)
|
setattr(self.instance, self.field.name, self.name)
|
||||||
|
|
||||||
# Update the filesize cache
|
# Update the filesize cache
|
||||||
self._size = len(content)
|
self._size = content.size
|
||||||
self._committed = True
|
self._committed = True
|
||||||
|
|
||||||
# Save the object because it has changed, unless save is False
|
# Save the object because it has changed, unless save is False
|
||||||
|
Loading…
Reference in New Issue
Block a user