refile.
One of features that i like is built in javascript library, which is contains several custom DOM events.
These events also can be listen, so you can provide logic easily around file upload lifecycle process.
" />
Progressbar Upload with Refile Gem
Blog Logo
on
read
There is a ruby gem library for file upload called refile.
One of features that i like is built in javascript library, which is contains several custom DOM events.
These events also can be listen, so you can provide logic easily around file upload lifecycle process.
By default refile provide helpers to built UI element of file input field:
From that snippet above refile won’t use built in javascript, to enable it just add an option called direct with true.
Refile provide several events which can attached into form upload element, for attaching the events you can use addEventListener :
Because we focused only progressbar upload, lets construct the form to using twitter bootstrap’s progressbar, currently i’m using slim-template for view.
Next lets write the javascript for calculate the progress and manipulate the UI progressbar.
We can utilize upload:progress event for this purpose.
Finally this is our progressbar using refile gem, for more information you can read on refile.