HTTP upload progress bars are rather obfuscated- they typically
involve a process running on the server keeping track of the size of
the tempfile that the HTTP server is writing to, then on the client
side an AJAX call is made every couple seconds to the server during
the upload to ask for the progress of the upload.
This is pretty ridiculous. Making million of AJAX requests (which
probably slow down your upload) just to poll the server on this
trivial fact? Your browser knows how much data you've sent - the best
solution would be to have this information stored in the DOM. As far
as I can tell, this is not happening.
Xupload (http://www.sibsoft.net/xupload.html) is a beautiful hack to
do this without AJAX. When you start your download it streams an HTML
back back to you slowly. The first part of the HTML is normal, with
at once. Then comes information about your upload in progress
(SP($size,$time,$speed,$files_uploaded,$time_left)) Basically: you're
loading a single page and as it loads the progress bar moves.
Can we do this in Rails? I've been experimenting with both Sean
Treadway's UploadProgress and mongrel_upload_progress but have had no