Hi i want to convert the files which i put into input field into base 64
Component.html

<div class="form-group">
<label for="kbis" class="col-sm-8 control-label">Votre Kbis :</label>
<input type="file" [(ngModel)]="me.kbis" name="kbis"class="form-control" 
#Image
(change)="handleFileInput($event.target.files)" 
accept=".xlsx,.xls,image/*,.doc, 
.docx,.ppt, .pptx,.txt,.pdf" ><br>
</div>

Component.ts

handleFileInput(file: FileList) {
this.fileToUpload = file.item(0);
//Show image preview
var reader = new FileReader();
reader.onload = (event:any) => {
const binaryString = btoa(event.target.result);

}
reader.readAsDataURL(this.fileToUpload);
}
}




But i got this into console

[image: Capture.PNG]

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to