简体   繁体   English

没有特殊的ajax上传器的上传进度指示器?

[英]Upload progress indicator without special ajax uploader?

i have a rails app which uploads a file (big files ~300mb). 我有一个Rails应用程序,可以上传文件(大文件〜300mb)。 is there a way to implement a progress indicator without using a special htnl5 uploader or install the nginx server module? 有没有一种方法可以实现进度指示器,而无需使用特殊的htnl5上传器或安装nginx服务器模块? 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. 我只知道JS / AJAX,其中的DOM是在成功上传回调后更新的。

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) 或者,您可以研究设置express / Node.js来处理流式上载,并使用AJAX更新DOM(在这种情况下,您的Node.js服务将与Rails分离运行-您将通过JSON从Rails连接到它)

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). 如果您使用的是纯AJAX,建议您拨打一个特殊电话,该电话可能会返回您当前的上传状态(/ upload / status / upload_id)。 You can have a timer and ask for progress every 2 seconds for instance. 您可以有一个计时器,例如每2秒请求进度。

On a server side you have a thread that handles upload and able to report a progress. 在服务器端,您有一个线程来处理上传并能够报告进度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM