content_length = int(request.META.get('CONTENT_LENGTH', 0))
if content_type == '':
    return HttpResponse(status=400)
if content_length == 0:
    return HttpResponse(status=400)
content_type = content_type.split(';')[0].strip()
try:
    charset = content_type.split(';')[1].strip()
except IndexError:
    charset = ''
file_name = path.split('/')[-1:][0]
field_name = file_name
How do I handle file upload via PUT request in Django?