Why is event.dataTransfer.items array (and .files object) always empty on my onDrop area event?

  angular, drop, file-upload, html

I’m writing a drop folder/file area in my Angular project, but for some reason the items array and files object (of a dropped file/folder) are always empty

HTML:

<div class="files" (drop)="dropFiles($event)"></div>

Code in the component class:

dropFiles(ev) {
    console.log(ev.dataTransfer);
}

Console.log output:

 dropEffect: "none"
 effectAllowed: "all"
 files: FileList {length: 0}
 items: DataTransferItemList {length: 0}
 types: []

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.