问题
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() 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.
回答1:
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.
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.
The onprogress
event is correctly fired on Chrome for Android.
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
来源:https://stackoverflow.com/questions/17901630/fineuploader-onprogress-callback-does-not-work-for-android