I'm trying to save user information in a phonegap application but upon trying
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {
console.log('file system open: ' + fs.name);
fs.root.getFile("newPersistentFile.txt", { create: true, exclusive: false }, function (fileEntry) {
console.log("fileEntry is file?" + fileEntry.isFile.toString());
// fileEntry.name == 'someFile.txt'
// fileEntry.fullPath == '/someFile.txt'
writeFile(fileEntry, null);
}, onErrorCreateFile);
}, onErrorLoadFs);
I get the error
Uncaught ReferenceError: onErrorLoadFs is not defined
and on commenting it out I get
Uncaught ReferenceError: onErrorCreateFile is not defined
and finally on commenting that out I get
Uncaught ReferenceError: writeFile is not defined
I am also running
window.addEventListener('filePluginIsReady', function(){
console.log('File plugin is ready');
requestFileSystem(LocalFileSystem.TEMPORARY, 5 * 1024 * 1024, function (fs) {
console.log('file system open: ' + fs.name);
createFile(fs.root, "newTempFile.txt", false);
}, onErrorCreateFile);
Incase the error was stemming from the file plugin not being ready but again I'm met with the error
Uncaught ReferenceError: createFile is not defined
Any suggestions or help would be greatly appreciated! Thanks for your time!
onErrorCreateFile and onErrorLoadFs are functions that you need to define, e.g.:
function onErrorCreateFile() {
console.log("Create file fail...");}
function onErrorLoadFs() {
console.log("File system fail...");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With