WICG / entries-api

Spec defining browser support for file/directory upload by drag-and-drop
https://wicg.github.io/entries-api/
Other
41 stars 9 forks source link

How to add FileSystemEntry to DataTransferItemList ? #29

Open mhofman opened 5 years ago

mhofman commented 5 years ago

There doesn't seem to be a way to add FileSystemEntry objects to a DataTransferItemList, preventing creating drag (and clipboard) events containing directories.

This is currently preventing Chrome OS to implement drag and drop of directories since the Files app uses existing Web APIs. See https://crbug.com/937585

inexorabletash commented 5 years ago

Given the exploratory work going on around more modern file and datatransfer APIs, not going to rush to add something here.

mhofman commented 5 years ago

Of course, just wanted to make sure the use case was captured. Btw, how do these APIs relate to the directory-updload proposal? Has that been abandoned?

inexorabletash commented 5 years ago

So far as I know. IIRC, Microsoft and Mozilla were pushing on it, but ended up shipping an API compatible with Chrome's instead. (Which prompted me to write this to have the behavior documented.)

Robinson-George commented 4 years ago

Is the API compatible with Chrome capable of obtaining the files AND directories selected in the standard File Picker dialog?

inexorabletash commented 4 years ago

Is the API compatible with Chrome capable of obtaining the files AND directories selected in the standard File Picker dialog?

As noted over in #15 and https://wicg.github.io/entries-api/#issue-4cc238bb, in Chrome, webkitEntries is only populated as the result of a drag-and-drop operation, not when the element is clicked. This requires iterating over the File objects and reconstructing the directory tree using webkitRelativePath

Definitely not ideal. But also not exactly on topic for this issue.