JS how to determine whether a file or a folder is dragged in. Dragging a file or folder finds that ev.dataTransfer.files is an array of only one element, and how to determine whether a file or a folder is dragged in. The current practice is to find that the difference between a file and a folder is that the type of the file is not empty, while the type of the folder is empty, so I do not know whether it is correct to distinguish the file and the folder according to whether the type is empty.
below the image below is a file drag under the first FileList, and a folder drag under the second FileList.