2

I'm trying to display images from my remote server in an app using phoneGap along with jquery(mobile) and PHP.

I read from the doc that this function does the job:

FileTransfer

Here: http://docs.phonegap.com/en/1.6.0/cordova_file_file.md.html

 // !! Assumes variable url contains a valid URI to a file on a server and filePath is a valid path on the device

var fileTransfer = new FileTransfer();

fileTransfer.download(
    url,
    filePath,
    function(entry) {
        console.log("download complete: " + entry.fullPath);
    },
    function(error) {
        console.log("download error source " + error.source);
        console.log("download error target " + error.target);
        console.log("upload error code" + error.code);
    }
);

My problem is that I don't know what should be the file path to get to the root of my app ? And the major issue (which is the reason I've created this post) is that I read from within the doc that

It is also possible to download a file from remote and save it on the device (only iOS and Android).

Which is a problem to me ..

So what shold I do, can I just give the image url from the server to the src of my image in my phonegap app ? will that work ?

Thanks

4

1 回答 1

2

我通常使用 html 标签在 phonegap 应用程序中显示来自远程服务器的图像。

于 2013-07-02T11:50:16.770 回答