#12955 closed (fixed)
Large file (bigger than 2GB) upload
Reported by: | iscarface | Owned by: | Ivan Sagalaev |
---|---|---|---|
Component: | File uploads/storage | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When i'm uploading more than 2GB file i have an error:
OverflowError at /admin/films/film/add/
long int too large to convert to int
Request Method: POST
Request URL: http://192.168.1.10/admin/films/film/add/[[BR]]
Exception Type: OverflowError
Exception Value:
long int too large to convert to int
Exception Location: /usr/lib/python2.5/site-packages/django/db/models/fields/files.py in _get_size, line 76
Python Executable: /usr/bin/python
Python Version: 2.5.2
Python Path: ['/var/www/', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/PIL', '/var/lib/python-support/python2.5']
Server time: Втр, 23 Фев 2010 17:16:19 +0200
Django version = (1, 2, 0, 'alpha', 0)
Attachments (1)
Change History (8)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 15 years ago
comment:3 by , 15 years ago
The problem is caused by using len(self.file)
because len() tries to typecast the result of {{len()}} to an actual int. Which on 32-bit machines is < 2G. I think the fix might be as simple as using directly {{.size}} instead of {{len()}} everywhere...
comment:4 by , 15 years ago
Owner: | changed from | to
---|
by , 15 years ago
Attachment: | django-12955.diff added |
---|
following isagalaevs suggestion this patch fixed the problem for us
comment:5 by , 15 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Triage Stage: | Accepted → Ready for checkin |
This looks good and the patch is even more pythonic. Shouldn't there be a test for filesize above 2GB or would that be onerous?
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Traceback:
Environment:
Request Method: POST
Request URL: http://213.111.127.198/admin/films/testfile/add/
Django Version: 1.2 pre-alpha
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
Installed Middleware:
('django.middleware.common.CommonMiddleware',
Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in wrapper
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in call
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in call
File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in inner
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view
File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in _commit_on_success
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in add_view
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in save_model
File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save
File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save_base
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py" in pre_save
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py" in save
File "/usr/lib/python2.5/site-packages/django/core/files/storage.py" in save
File "/usr/lib/python2.5/site-packages/django/core/files/storage.py" in _save
File "/usr/lib/python2.5/site-packages/django/core/files/base.py" in chunks
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py" in _get_size
Exception Type: OverflowError at /admin/films/testfile/add/
Exception Value: long int too large to convert to int
Environment:
Request Method: POST
Request URL: http://213.111.127.198/admin/films/testfile/add/
Django Version: 1.2 pre-alpha
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
Installed Middleware:
('django.middleware.common.CommonMiddleware',
Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in wrapper
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in call
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in call
File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in inner
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view
File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in _commit_on_success
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in add_view
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in save_model
File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save
File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save_base
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py" in pre_save
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py" in save
File "/usr/lib/python2.5/site-packages/django/core/files/storage.py" in save
File "/usr/lib/python2.5/site-packages/django/core/files/storage.py" in _save
File "/usr/lib/python2.5/site-packages/django/core/files/base.py" in chunks
File "/usr/lib/python2.5/site-packages/django/db/models/fields/files.py" in _get_size
Exception Type: OverflowError at /admin/films/testfile/add/
Exception Value: long int too large to convert to int