2020-08-04 10:42:28 +00:00
|
|
|
from rest_framework.parsers import FileUploadParser
|
|
|
|
|
|
|
|
|
|
|
|
class ChunkUploadParser(FileUploadParser):
|
|
|
|
"""
|
|
|
|
Parser for chunk upload data.
|
|
|
|
"""
|
2020-11-14 15:04:41 +00:00
|
|
|
|
2020-08-04 10:42:28 +00:00
|
|
|
def get_filename(self, stream, media_type, parser_context):
|
|
|
|
"""
|
|
|
|
Detects the uploaded file name.
|
|
|
|
"""
|
2020-11-14 15:04:41 +00:00
|
|
|
view = parser_context["view"]
|
|
|
|
return parser_context["kwargs"][view.lookup_field]
|