Hello guys,
I am trying to get my webpy app to show some feedback on the progress of
file upload using ajax. I thought it would be enough with reading the file
in chunks like this:
while keep_reading:
chunk = params['file'].file.read(settings.CHUNK_SIZE)
read = read + len(chunk)
if not chunk or read > settings.MAX_SIZE:
keep_reading = False
else:
fout.write(chunk)
fout.flush()
os.fsync(fout.fileno())
And then having another request path which would be called using ajax and
would return the current size of the file. Anyway, the thing is that I have
noticed that none of the POST code is executed till the whole file is sent
by the browser. I have read this thread:
http://groups.google.com/group/webpy/browse_thread/thread/63b215e257beefe9/bbd9a9c2cff7f44e?lnk=gst&q=progress+bar#bbd9a9c2cff7f44e
and done something similar hoping that reading web.ctx.env['wsgi.input'] in
blocks instead would solve the issue, but once again, nothing is done till
the whole file is received.
Did anyone manage to implement the file upload progress?
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.