有关文件传输()问题下载的PhoneGap [英] Issue about FileTransfer() download in PhoneGap

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

问题描述

结果
我一直在开发一个应用程序的PhoneGap Android和iOS。我试图用下载文件传输()下载从服务器中的文件(.PDF),它的正常工作。但是当我使用fileTransfer.onprogress话,好像下载超过文件的大小(我的文件为20MB,并下载40兆字节2倍以上)。


I have been developing a Phonegap App for Android and IOS. I am trying to download a file(.pdf) from server using FileTransfer() download, and it's working normally. But when I use fileTransfer.onprogress then it seems to download more than the size of the file (my file is 20Mb and it downloads 40Mb more than 2x).

fileTransfer.onprogress = function(progressEvent) {
    if (progressEvent.lengthComputable) {
        var percent = progressEvent.loaded/progressEvent.total;
        //percent allways equal 2, than more 2x size of real file 
        console.log(percent);
    } 
};
//Else FileTransfer() upload working well.

我不知道为什么?为什么会这样任何人都可以解释一下吗?

I don't known why? Can anyone explain to me why this is happening?

推荐答案

您是不是唯一一个遇到此:

You are not the only one experiencing this:

<一个href=\"http://www.raymondcamden.com/index.cfm/2013/5/1/Using-the-Progress-event-in-PhoneGap-file-transfers#c1D7DAFD0-D62D-FBCB-6ADA9A452CDD6A2E\" rel=\"nofollow\">http://www.raymondcamden.com/index.cfm/2013/5/1/Using-the-Progress-event-in-PhoneGap-file-transfers#c1D7DAFD0-D62D-FBCB-6ADA9A452CDD6A2E

这篇关于有关文件传输()问题下载的PhoneGap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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