How can JS tell if a file or a folder is being dragged in?

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.

Mar.02,2021

refer to this?

https://codeshelper.com/a/11.


< hr >

if you want to see specific js drag upload files, take a look at this article front end page file drag upload module js code example

Menu