javascript - Convert a file to base64 using FileReader and Promises -


i wrote function use promises convert uploaded file base64 , trying return base64 string. getting http error 200 , i'm not sure if it's returning right string.

function getbase64(file) {     var deferred = $.deferred();     var reader = new filereader();     reader.onload = function (event) {         let base64string = reader.result.split(',').pop();         deferred.resolve(base64string);     };     reader.readasdataurl(file);     return deferred.promise(); }; 


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -