anpleenko
9/1/2015 - 5:34 PM

get base64 in filereader

get base64 in filereader

function readImage(input) {
    var reader = new FileReader();

    reader.onloadend = function(){
        var base64 = reader.result.substring(reader.result.indexOf(',')+1, reader.result.length)
        console.log(base64)
    }

    reader.readAsDataURL(input.files[0])
}

$(".file-select").change(function(){
    readImage(this);
});