Jul 252012
 

Drag and drop a folder of files and you’re out of luck. Currently browsers just ignore folders dropped into them. Chrome, however, recently added folder support to its bag of drag-and-drop tricks. You’ll need to be using Chrome 21 or better (currently in the dev channel).

If you’d like to see how the new folder parsing works, HTML5Rocks has a quick little tutorial on how you can add support for folders to your web app.

The JavaScript required to support folders consists of an extra loop to tunnel through folders and get to “Entry” objects. That’s a slightly different syntax than what you might have seen if you’ve read tutorials on the File API in the past — using “Entry” instead of “File”. There are two new properties as well — .isFile and .isDirectory.

MORE:  Chrome 21 Adds New Drag-and-Drop Tricks | Webmonkey | Wired.com.