I know very well that you are not allowed to load an entire folder using drag and drop. The problem is, how can I tell if someone is trying to do this? If you drag a folder into the browser, it will behave exactly as if you were dragging a file with some webkit extension that you donβt know about, for example, ".sh". How can you tell the difference?
I tested this on Chrome and Safari and Firefox on Mac OS X and Windows. Depending on the browser and OS, I get slightly different results. Sometimes it manages to load a file with a zero byte. Sometimes it uploads a folder image. Sometimes it cannot load anything.
event.dataTransfer.types and event.dataTransfer.items are both false and say that the type is "File" or "file", respectively.
Firefox provides this list of types:
{"0":"application/x-moz-file","1":"text/x-moz-url","2":"text/plain","3":"Files"}
source share