javascript Jquery 文件上传插件进度条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11404705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 13:04:42  来源:igfitidea点击:

Jquery File Upload Plugin Progress Bar

javascriptjquery

提问by

This pluginmanages file uploads in a webpage and can add a lot of UI elements to the upload process.

这个插件管理网页中的文件上传,可以在上传过程中添加很多 UI 元素。

You create an input file type element and then strap the js files, use the instantiating code and walla. There are options and API instructions for accomplishing different features.

您创建一个输入文件类型元素,然后绑定 js 文件,使用实例化代码和 walla.js。有用于完成不同功能的选项和 API 说明。

Problem:

问题:

I want to implement a progress bar for file uploads but so far there is no real instruction on how to do that in the docs.

我想为文件上传实现一个进度条,但到目前为止,文档中没有关于如何做到这一点的真正说明。

I found one option you can set by pasting this code in:

我找到了一个您可以通过将此代码粘贴到以下位置来设置的选项:

progress: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10); }

But doing that it has not changed anything. Can someone who understands javascript please help me find out how to get a progress bar implemented?

但这样做并没有改变任何事情。懂javascript的人可以帮我找出如何实现进度条吗?

Thank you.

谢谢你。

回答by

Okay, after talking to the programmer for the plugin on Github he has added a section in the docs to include instructions for implementing a progress bar for the basic setup.

好的,在与 Github 上的插件的程序员交谈后,他在文档中添加了一个部分,其中包括为基本设置实现进度条的说明。

The convo between me and him is here: https://github.com/blueimp/jQuery-File-Upload/issues/1451#issuecomment-6869829

我和他之间的对话在这里:https: //github.com/blueimp/jQuery-File-Upload/issues/1451#issuecomment-6869829

The solution in the docs is here: https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin

文档中的解决方案在这里:https: //github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin

回答by Ben

From https://github.com/blueimp/jQuery-File-Upload/wiki/Extended-progress-informationIt looks like the jQuery UI version is different from the jQuery basic version of the plugin. Which version are you using? You can obviously see on that page the method for accessing the info in the basic jQuery version, and it claims that in the UI version you can get progress info automatically.

来自https://github.com/blueimp/jQuery-File-Upload/wiki/Extended-progress-information看起来 jQuery UI 版本与插件的 jQuery 基本版本不同。您使用的是哪个版本?您可以明显地在该页面上看到基本 jQuery 版本中访问信息的方法,并且它声称在 UI 版本中您可以自动获取进度信息。