本文介绍了FineUploader onProgress()回调不适用于Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

onProgress()回调在Android设备上不起作用.这是我的代码:

onProgress() callback of Fine Uploader does not work in Android devices. Here is my code:

onProgress: function(id, fileName, loaded, total)
{
    //alert('debug'); this alert shows after download is completer
    if (loaded < total) {
        progress = '"' + fileName + '" uploaded ' + Math.round(loaded / total*100) +'%';
        $('#progress').html(progress);
    }
    else {
        $('#progress').html('saving');
    }
}

上传完成后,将调用

onProgress().可能是什么问题,以及如何解决?在官方文档中,它表示:onProgress(String id, String name, int uploadedBytes, int totalBytes) - called during the upload, as it progresses. Only used by the XHR/ajax uploader.

onProgress() is called after uploading has finished. What can be problem and how to fix it?In official docs it says: onProgress(String id, String name, int uploadedBytes, int totalBytes) - called during the upload, as it progresses. Only used by the XHR/ajax uploader.

推荐答案

经过一番挖掘,我确定–撰写本文时– Android 4.0.4的常规浏览器不完全支持 XMLHttpRequest规范.具体来说,XMLHttpRequest对象不会触发 ProgressEvents 对于确定当前上传文件的进度至关重要.

After some digging around I determined that -- as of writing this -- Android 4.0.4's stock browser does not fully support the XMLHttpRequest specification. Specifically, the XMLHttpRequest object does not fire ProgressEvents which are essential to determining the progress of the currently uploading file.

我尝试了多种方式将事件处理程序绑定到onprogress事件,甚至遵循了,但无济于事.

I've attempted to bind event handlers to the onprogress event a variety of ways, and even followed the Mozilla Developer Network article, but to no avail.

onprogress事件已在Android版Chrome上正确触发.

The onprogress event is correctly fired on Chrome for Android.

我已经在此处的跟踪器中提交了一个问题.希望找到一种解决方法,或者Google等.解决此问题.

I've filed an issue in our tracker here. Hopefully a workaround is found, or Google et al. fix this issue.

如果您对解决方法有任何建议,请随时分享

If you have any suggestions for workarounds, please, feel free to share

这篇关于FineUploader onProgress()回调不适用于Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-09 03:13