I'm using "ngx-file-drop" on Angular 6.
<file-drop headertext="Drop files here" (onFileDrop)="dropped($event)"
(onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)" multiple>
<span>optional content (don't set headertext then)</span>
</file-drop>
And component file is
public dropped(event: UploadEvent) {
this.files = event.files;
for (const droppedFile of event.files) {
// Is it a file?
if (droppedFile.fileEntry.isFile) {
const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;
fileEntry.file((file: File) => {
// Here you can access the real file
// console.log("dropfile_file"+ droppedFile.relativePath, file);
this.drop_files.push(file);
console.log(this.drop_files);
});
} else {
// It was a directory (empty directories are added, otherwise only files)
const fileEntry = droppedFile.fileEntry as FileSystemDirectoryEntry;
console.log("file_entry"+ droppedFile.relativePath, fileEntry);
}
}
}
public fileOver(event){
console.log("file_over"+event);
}
public fileLeave(event){
console.log("file_leave"+event);
}
I've no idea how to validate file to using ngx-file-drop.
Is there any approch in ngx-file-drop to validate file? please help.
Thanks,