on first call in JS FileReader is null, and base64string is empty, but on second call code working... why?
var base64String = "";
function imageUploaded(input) {
var reader = new FileReader();
reader.onloadend = function () {
base64String = reader.result.replace("data:", "").replace(/^.+,/, "");
console.log(base64String);
}
reader.readAsDataURL(input);
return base64String;
}