I'm using "file-drop" tag to drag and drop image on Angular 6.
<file-drop headertext="{{adCrud.uploadMediaText}}"
(onFileDrop)="dropped($event)" (onFileOver)="fileOver($event)"
customstyle="filedrop" customstyle="adMedia"
(onFileLeave)="fileLeave($event)" >
I got the file[0] from (onFileDrop)="dropped($event)", but I've no idea how to show that image before upload it to the server, thanks in advance :/
---------------
Note: I'm trying to implement the below method but could find event.target ? from (onFileDrop)="dropped($event)"
media1change(event) {
if (event.target.files && event.target.files[0]) {
const reader = new FileReader();
// tslint:disable-next-line:no-shadowed-variable
reader.onload = (event: ProgressEvent) => {
this.adCrud.media1 = (<FileReader>event.target).result;
// // console.log(this.profile);
// this.uploadmedia1();
};
reader.readAsDataURL(event.target.files[0]);
}
this.media1File = event.target.files[0];
this.uploadmedia1(); }