-->

How to implement a progress bar in Ruby?

2019-07-13 17:21发布

问题:

We want to implement a progress bar for file uploading in one of our Ruby application. This needs to show the exact percentage of the upload. However, despite our best efforts we could not find a way to implement a progress bar that exactly replicate the file upload process.

Can you please help us with this?

回答1:

If your are using Apache and Passenger, you can use the Apache progress bar module.

Screencast: http://www.railsillustrated.com/screencast-file-uploads-progress-in-rails-passenger.html

Apache Module and installation instructions: http://drogomir.com/blog/2008/6/18/upload-progress-bar-with-mod_passenger-and-apache



回答2:

I have used mongrel_upload_progress in the past, but I found that it was quite a complex and delicate solution to the problem. I'd definitly recommend looking towards using passenger thru apache for your production environment, though.