I have developed app using phonegap, but have one issue on setting value to fileName variable inside reader.onloadend = function(e){}. Seems like locally it works, because alert message show proper value of fileName, but when i am trying to use outside onloadend, it doesnt work, mean it returns that fileName value is undefined.Where is the problem and how it can be solved? Trying to get value after calling "parent" function of .onloadend. here is code of function:
function gotFile(fileEntry) {
fileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function(e) {
fileName = slice_file(reader.result);
alert(fileName);
}
reader.readAsText(file);
});
del();
}