Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

Converting Image to base64 string in Typescript

function getBase64(event) {
   let me = this;
   let file = event.target.files[0];
   let reader = new FileReader();
   reader.readAsDataURL(file);
   reader.onload = function () {
     //me.modelvalue = reader.result;
     console.log(reader.result);
   };
   reader.onerror = function (error) {
     console.log('Error: ', error);
   };
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Converting #Image #string #Typescript
ADD COMMENT
Topic
Name
1+5 =