无法在cordova中找到我下载的文件

时间:2016-02-29 08:28:24

标签: cordova phonegap-plugins cordova-plugins visual-studio-cordova cordova-2.0.0

我正在开发visual studio 2013 apache cordova app。我想将文件从远程服务器下载到我的设备中。它已成功下载到路径`" file:///data/data/io.cordova.myapp/files/Download-Button1.png" ;,但我无法找到该文件。我想在下载文件夹中下载它。这是我的代码:

    $("#SaveFiles").click(function () {

        var pathToFile = cordova.file.dataDirectory + "Download-Button1.png";

        var fileTransfer = new FileTransfer();
        var uri = encodeURI("http://www.techaudible.org/wp-content/uploads/2014/05/Download-Button1.png");

        fileTransfer.download(
            uri,
             pathToFile,
            function (entry) {
                alert("download complete: " + pathToFile);
            },
            function (error) {
                alert("download error source " + error.source);
            },
            false,
            {
                headers: {
                    "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
                }
            }
        );

    });

0 个答案:

没有答案