how to upload large files in django temp directory location ?

14 views
Skip to first unread message

arvind yadav

unread,
Sep 16, 2019, 6:08:10 AM9/16/19
to Django users
def handle_uploaded_file(f):
    with open('/home/arvind/Desktop/newupload/documents/'+f.name, 'wb') as destination:
        filepath = destination.name
        for chunk in f.chunks():
           #time.sleep(1)
           destination.write(chunk)
           #


def fileupload(request):
    if request.method == 'POST':
        files = request.FILES.getlist('uploadfile')
        for f in files:
            handle_uploaded_file(f)
        return HttpResponse('add')
    return HttpResponse("done")

Reply all
Reply to author
Forward
0 new messages