jquerycordovaphonegap-pluginshybrid-mobile-appintel-xdk

Upload any type of file in phonegap / cordova


I am trying to upload file from Phone-gap using file transfer plugin but FILE_URI returns the file path in Blob
blob:http%3A//localhost%3A65304/506be833-4afb-42a4-beed-01e43bc9cd64
Then I used the below code to verify it and it returns error code 5.

Jquery Code:

window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + snapSrc, gotFile, fail);

function fail(e) {
    console.log("FileSystem Error");
    console.dir(e);
}

function gotFile(fileEntry) {

    fileEntry.file(function(file) {
        var s = "";
        s += "<b>name:</b> " + file.name + "<br/>";
        s += "<b>localURL:</b> " + file.localURL + "<br/>";
        s += "<b>type:</b> " + file.type + "<br/>";        
        document.querySelector("#status").innerHTML = s;
        console.dir(file);
    });
}
  1. How do i find the name and type of the file.
  2. How do i resolve error code 5.

Solution

  • This issue is solved,it worked perfectly in real device, i think the issue lies with intel xdk emulator.