jquery进度条显示上传文件进度
我想使用进度条来显示文件上传进度。 我目前正在使用以下 HTML 代码
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.progressbar.min.js"></script>
$(document).ready(function() {
$("#spaceused1").progressBar();
});
:
<span class="progressBar" id="spaceused1">25%</span>
<a href="#" onclick="$('#spaceused1').progressBar(20);">20</a>
<a href="#" onclick="$('#spaceused1').progressBar(40);">40</a>
<a href="#" onclick="$('#spaceused1').progressBar(80);">80</a>
当我单击上面的链接时,它工作正常。但现在我该如何显示文件上传进度呢?
请帮帮我。
I want to use progress bar to show file upload progress.
I'm currently using the following code
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.progressbar.min.js"></script>
$(document).ready(function() {
$("#spaceused1").progressBar();
});
HTML:
<span class="progressBar" id="spaceused1">25%</span>
<a href="#" onclick="$('#spaceused1').progressBar(20);">20</a>
<a href="#" onclick="$('#spaceused1').progressBar(40);">40</a>
<a href="#" onclick="$('#spaceused1').progressBar(80);">80</a>
It works fine when i click on the above links. But now how can i use to show the file upload progress?
Please help me out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用某种 Flash 上传器,因为这是从 JavaScript 获取进度通知的唯一方法。有一个很好的库,名为 SWFUpload,它有一个 jQuery 包装器 此处。
You'll need to use some kind of Flash uploader, as this is the only way to get progress notifications from JavaScript. There's a good library for this called SWFUpload, for which there is a jQuery wrapper here.
您将需要使用能够评估已上传文件量的工具 - flash 解决方案是一种可能,但 perl 也可以。
超级上传者
you will need to use something that has the capability of assessing how much of a file has been uploaded already - the flash solution is a possibility but perl is also capable.
uber uploader