html image blob to base64
I've got some problems about to fileinputjs.The images' src are blob.But i want to use images' src to do something.So i use readAsDataURL to get base64.But there are any problems about it 。 <script type="text/javascript"> $("#last").click(function(){ var blob=document.querySelector(".file-preview-image").src; var reader = new FileReader(); //通过 FileReader 读取blob类型 reader.onload = function(){ this.result === dataURI; //base64编码 } console.log(reader.readAsDataURL(blob)); }) </script> Then there are Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type