I want to accomplish upload on file drag: I am using ng2-file-upload version 1.2.1 with following code snippet:
app.module.ts:
import { FileUploadModule } from 'ng2-file-upload/ng2-file-upload';
..
imports: [
FileUploadModule
]
component.ts:
import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
...
class AppXYZComponent{
private uploader: FileUploader = new FileUploader({ url: 'blah.com' });
public hasBaseDropZoneOver:boolean = false;
//public hasAnotherDropZoneOver:boolean = false;
public fileOverBase(e:any):void {
console.log("hasBaseDropZoneOver", e);
this.hasBaseDropZoneOver = e;
}
}
app.component.html:
<div class="well" ng2FileDrop [uploader]="uploader" [ngClass]="{'another-file-over-class': hasBaseDropZoneOver}"
(fileOver)="fileOverBase($event)"
>
Drop CSV here
</div>
The function fileOverBase gets successfully called on drag, with event e printed as true. Now How can i get the dragged file's object??
I know its late reply but may it will help to others
change app.component.html: with ** code
change component.ts: as below ** code