D
Dave
Greetings.
Ive been trying to figure out how I can write to a file from an HTTP
post while it is being uploaded. So far ive realized that my script
isn't getting the data until the browser is done uploading. What I want
to accomplish is a way to track the progress of a file upload. I'm
guessing that if I can get it to write to a file as it is uploaded I can
load another browser to check the progress of the transfer (by refreshing).
Here is the general idea I have tried:
if item.file:
filen = item.filename
filen1 = filen.split('\\')
filen2 = filen1[len(filen1)-1]
outfile = open(path + filen2 + '.tmp','wb')
buff = item.file.read(40000)
while buff != "":
outfile.write(buff)
buff = item.file.read(40000)
if not buff:
break
Works, but I recieve the data all at once rather then while..
Perhaps it is my ignorance about how http works and that there is no
other way?
Thanks in advance.
-Dave
Ive been trying to figure out how I can write to a file from an HTTP
post while it is being uploaded. So far ive realized that my script
isn't getting the data until the browser is done uploading. What I want
to accomplish is a way to track the progress of a file upload. I'm
guessing that if I can get it to write to a file as it is uploaded I can
load another browser to check the progress of the transfer (by refreshing).
Here is the general idea I have tried:
if item.file:
filen = item.filename
filen1 = filen.split('\\')
filen2 = filen1[len(filen1)-1]
outfile = open(path + filen2 + '.tmp','wb')
buff = item.file.read(40000)
while buff != "":
outfile.write(buff)
buff = item.file.read(40000)
if not buff:
break
Works, but I recieve the data all at once rather then while..
Perhaps it is my ignorance about how http works and that there is no
other way?
Thanks in advance.
-Dave