I'm quite new to Ionic. I'm facing problem to get the filepath of my file to upload the chosen file. Thus, I created this file browser for my app but it return empty array. I have followed every step shown in Create A File Browser Using Ionic Framework but still not working. I included part of my code and the result below. Can someone please explain what's wrong with my code?
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
}
function onFileSystemSuccess(fileSystem) {
console.log(fileSystem.root);
var directoryReader = fileSystem.root.createReader();
console.log(directoryReader);
directoryReader.readEntries(function(entries) {
console.log(entries);
}, function(error) {
console.log(error);
// deferred.reject(error);
});
}
I found a solution to upload my file to the remote server instead of using File Browser. I use ng-file-upload directive to upload files from mobile devices to my remote server. It works perfectly.