Javascript FileAPI: Iterating Directories?

后端 未结 1 921
天涯浪人
天涯浪人 2021-01-14 23:39

Firefox 3.6 let\'s you drop a directory onto some element (using the Drag And Drop API) and process those files with the FileAPI. How does that work with directories?

<
相关标签:
1条回答
  • 2021-01-14 23:57

    Theoretically, what you describe is doable with the FileReader API. For example, this demo reads a .zip file (hit load photos.zip), unpacks its contents, and displays the list of pictures it contains to the user.

    For general folder drag and drop, there are two bugs holding Chrome/WebKit back: 1, 2. When those get fixe, you'll be able to drag a folder from the OS onto an <input type="file" webkitdirectory> and traverse all its hierarchy. To see webkitdirectory in action, check out this demo in Chrome.

    0 讨论(0)
提交回复
热议问题