Я использую «ngx-file-drop» на 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>
И файл компонента
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);
}
Я понятия не имею, как проверить файл с помощью ngx-file-drop.
Есть ли какой-либо подход в ngx-file-drop для проверки файла? пожалуйста помоги.
Спасибо,