[Mongrel] [ANN] Mongrel Upload Progress 0.2 -- With Instructions and Examples

Kaspar Schiess eule at space.ch
Tue Sep 12 05:15:38 EDT 2006


Hello all,

Is it just me or are the upload plugin instructions all buggy? I had to 
change the following bits of code:

- FilesController#progress: #check is an instance method if the 
Singleton Mongrel::Uploads, so Uploads.instance.check instead of 
Uploads.check.

   def progress
     render :update do |page|
       @status = Mongrel::Uploads.instance.check(params[:upload_id])
       page.upload_progress.update(@status['size'], @status['received']) 
if @status
     end
   end

- Progressbar would not show at first. I had to fix the javascript at 
least in one place:

      update: function(status, statusHTML) {
        this.statusText.innerHTML = statusHTML;
+      this.statusBar.style.width = '' + Math.floor(this.statusBarWidth 
* status) + 'px';
-      this.statusBar.style.width = Math.floor(this.statusBarWidth * 
status);
      }

- Not a problem of the instructions per se, but worth mentioning: 
Lighttpd seems to buffer the whole upload and then send it all at once 
to a proxied mongrel instance behind it. So that won't give you any 
progress bar at all. Pound as a frontend behaves much better.

I hope to be of help with this tale of experience made. Really nice work 
on the plugin guys, thank you a lot. Zed, thanks for Mongrel, it has 
given me confidence about rails deployment for the first time - have 
tried all other magic bullets, and most of them didn't quite work.

best regards
kaspar

neotrivium.com - the swiss ruby shop




More information about the Mongrel-users mailing list