Does anyone know why using 'fileEntry.file' keeps failing in my Windows 8 app?
If I use the following code it fails:
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(new Windows.Foundation.Uri(cordova.file.applicationDirectory + 'www/assets/pages/en/navigation.html')).done(usethisfile, fail);
function usethisfile(fileEntry) {
console.log("Im going to use the file... " + fileEntry.path);
fileEntry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function() {
console.log("Successful file read: " + this.result);
};
reader.readAsText(fileEntry);
}, onErrorReadFile);
}
but if I remove the 'fileEntry.file' part it works fine:
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(new Windows.Foundation.Uri(cordova.file.applicationDirectory + 'www/assets/pages/en/navigation.html')).done(usethisfile, fail);
function usethisfile(fileEntry) {
console.log("Im going to use the file... " + fileEntry.path);
//fileEntry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function() {
console.log("Successful file read: " + this.result);
};
reader.readAsText(fileEntry);
//}, onErrorReadFile);
}
The official docs say to use 'fileEntry.file': https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/index.html and I already have the app running on both the Android and the Apple stores so I'm hoping I can continue to use all the current functions that already use 'fileEntry.file' for the Windows version.
The error I get is: 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'file'.
I'm using Cordova via the command-line and Visual Studio to run it if that helps at all.
Not 100% sure but try adding e argument when you define the onloadend method
User contributions licensed under CC BY-SA 3.0