diff --git a/apps/core/__pycache__/utils.cpython-39.pyc b/apps/core/__pycache__/utils.cpython-39.pyc index 373b6a9d214ce70dd9e42840efc68c52f4bbec29..c3bd4d9e3f2dd97b892efffb31fb172ff32cd040 100644 Binary files a/apps/core/__pycache__/utils.cpython-39.pyc and b/apps/core/__pycache__/utils.cpython-39.pyc differ diff --git a/apps/core/utils.py b/apps/core/utils.py index 590c21fd8520bbb58b92ae821ef7dc0075170fb4..b527b987e4eb81f3043e4ad3887131edf868bff2 100644 --- a/apps/core/utils.py +++ b/apps/core/utils.py @@ -4,6 +4,7 @@ import logging from django.contrib.contenttypes.models import ContentType from moviepy.editor import VideoFileClip +from wsgiref.util import FileWrapper from .models import Video, Playlist, TagToObject, DYNAMIC, PlaylistVideo @@ -24,10 +25,13 @@ def download_file(url): return local_filename -def handle_uploaded_file(f, file_name): +def handle_uploaded_file(file, filename): chunk_count = 0 - with open(file_name, 'wb+') as destination: - for chunk in f.chunks(): + + wrapper = FileWrapper(file, blksize=100) + with open(filename, 'wb+') as destination: + # for chunk in file.chunks(): + for chunk in wrapper: destination.write(chunk) chunk_count += 1