I have created a local PDF using jsPDF and I have successfully tested Cordova's FileTransfer.
However, I'd like to upload the file to Appery's database file collection so I can eliminate having another server.
I have read http://devcenter.stage-dev.appery.io/...
and this is what I am trying
code 
 window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
Code: Select all
 function gotFS(fileSystem) { 
     fileSystem.root.getFile("test.pdf", {create: false}, gotFileEntry, fail); 
 } 
 function gotFileEntry(fileEntry) { 
     fileEntry.file(gotFile, fail); 
 } 
 function gotFile(file){ 
     readDataUrl(file); 
     //readAsText(file); 
 } 
 function readDataUrl(file) { 
     var reader = new FileReader(); 
     reader.onloadend = function(evt) { 
         console.log("Read as data URL"); 
         console.log(evt.target.result); 
     }; 
     reader.readAsDataURL(file); 
       call_script(reader); 
 } 
 function readAsText(file) { 
     var reader = new FileReader(); 
     reader.onloadend = function(evt) { 
         //console.log("Read as text"); 
         console.log(evt.target.result); 
     }; 
     reader.readAsText(file); 
 } function call_script() { 
     upload_service.execute(??? what goes here ??? or do I bind in mapping???);
} 
     function fail(evt) { 
         console.log(evt.target.error.code); 
     }
/code
Question:
In the files upload service, what type of data are you expecting? I am trying to use Phonegaps filesystem to return a text or binary string and I am getting an error
code 
 { 
     "status":400, 
     "uri":"https://api.appery.io/rest/1/db/files", 
     "response":{ 
         "code":"BCXX002", 
         "description":"Cannot consume content type" 
     } 
 }
/code
Thanks!