获取上传文件数 [英] Get upload file count

查看:118
本文介绍了获取上传文件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里使用jquery上传器,我想知道如何

I am using jquery uploader from here and I would like to know how do I get the total number of files has been added and not uploaded.

有没有关于新版本的具体文档,任何人都可以告诉我我该怎么办?

There is no specific documentation on the new version so can anyone say me how do I do this?

因为我需要这样上传n个文件中的1个

文档中说:

$('#fileupload').bind('fileuploadadded', function (e, data) {
  //Here I need to get the upload count.
 });

如果我如下所示它给我计数为1

And If I as shown below it gives me count as 1

var totalfiles = data.files.length; 
alert(totalfiles);


推荐答案

文档后面有一个名为'fileuploadadd'的事件

Following the documentation there's an event called 'fileuploadadd' that will fire every time a file has been added to the queue, so you could create a counter and increment it when the event is called.

var filestoupload =0;     
$('#fileupload').bind('fileuploadadd', function (e, data) {
      filestoupload++;
     });

这篇关于获取上传文件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆