Can I drag and drop multiple files, via a single file, using HTML5?
I have a webpage that is using HTML5's Drag and Drop API with its File API. While simple drag and drop works well, I want to be able drag and drop a file that contains local file paths, and have those files processed as well.
For instance, let's say I have a file named list.txt. It contains:
- C:\users\bob\file1.txt
- C:\users\bob\file2.txt
- C:\users\alice\file3.txt
The behavior I'm looking for is to drag and drop list.txt onto the webpage. As a result, the file is parsed, and each file listed within (file1.txt, file2.txt, file3.开发者_如何学运维txt) is also "dropped", as if the user had manually dragged and dropped each one.
Is this possible? If not, are there other ways for a user to do bulk drag and drop, that doesn't require manually dragging and dropping each file one at a time?
Thanks
Nope; this is a security feature, to assure that your Javascript is only getting access to things specifically "granted" to it.
No. The only way to achieve multiple-file drag and drop is to select multiple files and drag the group into the browser. This only works in some browsers.
You can try this out by dragging multiple files into gmail's attachment header.
精彩评论