If I understood correctly, you only need to know if the file was
successfuly downloaded
or not on the server side.
Don't know if there are better ways in web2py but...
...this code, that goes into a controller, should do the trick:
import os, sys
def abort(status_code, message=None):
raise HTTP(404, message)
def index():
filename = request.args(0) or abort(404)
fullpath = os.path.join(request.folder, 'uploads', filename)
def stream():
try:
with open(fullpath, 'rb') as f:
while True:
data = f.read(1024)
if not data:
break
yield data
except:
# with any error, assume file not fully downloaded
print >>sys.stderr, 'failed'
else:
# if you reach this point the file was successfully
# downloaded. Do what you need on the backend side.
print >>sys.stderr, 'done'
headers = {'Content-Type': 'application/octet-stream'}
raise HTTP(200, stream(), **headers)
PS: You dont need to do any checksum anywhere. TCP is reliable.
It guarantees that everything that is transmitted is error free and ordered.
Ricardo