I have a function like the following, but the function calling this one return undefined, I don't know why.
$.fileReader_g = function(file){
var reader = new FileReader();
reader.onloadend = function(){
return {
result: reader.result,
size: file.size,
name: file.name
}
}
if (file){
reader.readAsDataURL(file);
} else {
console.log('Upload Failed');
}
}
The above is called by the following.
$(document).on('change', '.album_art_select', function(){
var cow = $.fileReader_g($(this)[0].files[0]);
console.log(cow);
});
Where am I missing this?