I need to download a CSV file from my Phonegap app

46 Views Asked by At

The framework is Codeigniter. I have an array by a response from ajax call which is converted to a CSV file and stored as CsvString = "data:application/csv," + encodeURIComponent(array_name); method. Now I need to download this CsvString. I have checked File transfer plugin but it required a URL which is not applicable in my case. Is there any alternative way. File Transfer plugin required URL which is not applicable in my case.

fileTransfer.download(
    uri,
    fileURL,
    function(entry) {
        console.log("download complete: " + entry.toURL());
    },
    function(error) {
        console.log("download error source " + error.source);
        console.log("download error target " + error.target);
        console.log("download error code" + error.code);
    },
    false,
    {
        headers: {
            "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
        }
    }
);

I already generated the file by ajax call all I need to download it.

0

There are 0 best solutions below