Need help in receiving first 500 bytes of an incoming file from client-side and after it is the download must be resumed.

4 views
Skip to first unread message

Milind Yadav

unread,
Sep 6, 2019, 7:44:30 AM9/6/19
to Django users
Hi,

I am trying to receive the first 500 bytes of a file coming from client-side before it gets completely downloaded onto the server.

I need to compute the hash value of the first 500 bytes and compare with hashes in database. If no match is found then resume the download i.e. remaining bytes are sent and the file gets saved onto the server.


PSEUDO-CODE:

from django.incoming.data import packets

first_500 = []

for packet in packets:
    
    if first_500.size+packet.body.size <= 500 bytes:
        first_500.append(packet.body)
    
    else:
        temp = packet.body.slice_body(500 bytes-first_500.size)
        first_500.append(temp)
        break


This will save a lot of time and space in case a duplicate is encountered.

Regards
Reply all
Reply to author
Forward
0 new messages