Hi, Please let me know how can I drag and drop a directory from windows onto Adobe AIR panel. The folder has subFolders inside. The subFolders have many files. I want to drag the parent folder and drop it so that the whole structure has to get uploaded. Please help.
A:
It is rather easy to upload folders. When detecting a drop using the drop event, you get supplied wit ha list of files dropped. You can then determine if it is the dropped file is a folder, and if it is, then you can get all the files listed under it (which includes files) and if any of those are folders, then recurse further down.
Basically, adobe air treats files and folders as the same object.
In the drop event put
var files = event.dataTransfer.getData( "application/x-vnd.adobe.air.file-list" );
var fileData = [];
for (var f = 0; f < files.length; f++)
{
if (files[f].isDirectory) {
//process this folder recursing through subfolders
} else {
//we have a file
}
}
You can then recurse through the object adding files and files to the server as needed
Serge Meunier
2009-11-23 15:01:04