i have a rails app which uploads a file (big files ~300mb). is there a way 开发者_开发问答to implement a progress indicator without using a special htnl5 uploader or install the nginx server module? just using the standard file upload field?
thanks in advance
I'm only aware of JS/AJAX where the DOM is updated on successful upload callback.
Alternatively, you could look into setting up express/Node.js to handle streamed uploading and use AJAX to update DOM (in this case your Node.js service would run decoupled from Rails - you'd be connecting to it from Rails via JSON)
If you are doing that pure AJAX, I would suggest you have a special call which might return you current status of upload (/upload/status/upload_id). You can have a timer and ask for progress every 2 seconds for instance.
On a server side you have a thread that handles upload and able to report a progress.
精彩评论