相关疑难解决方法(0)

jQuery文件上传显示剩余时间?

嗨,我正在使用jQuery文件上传

它工作正常,我向用户显示一个进度条,显示上传进度,代码如下:

$('#fileupload').fileupload({
    /* ... */
    progressall: function (e, data) {
        var progress = parseInt(data.loaded / data.total * 100, 10);
        $('#progress .bar').css(
            'width',
            progress + '%'
        );
    }
});
Run Code Online (Sandbox Code Playgroud)

在我的页面上,我刚刚包含了jquery.fileupload.js文件.在progressall函数的数据中,我可以看到比特率,总文件大小和当前加载的数据,正如我所说,按预期更新我的进度条.但是,在网站上阅读此链接表明我可以获得额外信息,包括剩余时间?然而,我一直无法做到这一点.还有一个jquery.fileupload-ui.js文件 - 我尝试在我的jquery.fileupload.js之后包含它,但我没有看到时间仍然有问题被添加到progressall函数中的数据.我也试过删除jquery.fileupload.js,只是包含了jquery.fileupload-ui.js但是这打破了我的文件上传而且它没有运行.

无论如何,我可以轻松地计算使用比特率/数据加载和总大小的剩余时间,还是有人建议我应该从插件中获得这个扩展信息的正确方法?

javascript jquery file-upload jquery-file-upload

1
推荐指数
2
解决办法
4127
查看次数