HTTP Download very Big File
- by Luca
I'm working at a web application in Python/Twisted.
I want the user to be able to download a very big file ( 100 Mb). I don't want to load all the file in memory (of the server), of course.
server side I have this idea:
...
request.setHeader('Content-Type', 'text/plain')
fp = open(fileName, 'rb')
try:
r = None
while r != '':
r = fp.read(1024)
request.write(r)
finally:
fp.close()
request.finish()
I expected this to work, but I have problems:
I'm testing with FF... It seems the browser make me wait until the file is completed downloaded, and then I have the open/save dialog box.
I expected the dialog box immediately, and then the progress bar in action...
Maybe I have to add something in the Http header... Something like the size of the file?