I'm trying to set up a large file upload system using resumable.js and django. The front end is all properly configured, and for the django side of things I am using django-resumable. I'm using a very basic view to handle the upload:
from resumable.views import ResumableUploadView
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class UserFileUploadView(ResumableUploadView):
@property
def chunks_dir(self):
chunks_dir = getattr(settings, 'MEDIA_ROOT', None)
if not chunks_dir:
raise ImproperlyConfigured(
'You must set settings.MEDIA_ROOT')
return chunks_dir
When I upload a file, it appears to upload correctly, but I can't see the chunks or the completed file in the MEDIA_ROOT
directory.
If I cancel the upload, the server sometimes mentions a ConnectionAbortedError
with a few AttributeErrors
following it, and starting a new upload ignores all uploaded chunks. If I allow the upload to complete, I can't upload the file again until the page refreshes.
In looking over the django-resumable code, I understand how it's supposed to function and can't see any reason why it shouldn't. Is there any way to figure out if the chunks are uploading, and where they're going if they are?
It turned out that the issue was to do with the routing. I am using JSON Web Tokens for authentication, but the path to the Upload View used login_required()
, which didn't seem to work. I also seem to be providing my JWTs incorrectly, with a token:
field rather than in an Authentication:
header.