HTML and CSS Reference
In-Depth Information
FIGURE 9-7 The File open picker component in action.
Multiple selections
The previous example only allows users to select a single file. To enable multiple selections, you just
change the function that triggers the user interface. Here's how:
openPicker.pickMultipleFilesAsync().then(function (files) {
if (files.size > 0) {
var buffer = "You picked:\n";
for (var i = 0; i < files.size; i++) {
buffer = outputString + files[i].name + "\n";
}
TodoList.alert(buffer);
} else {
// The user dismissed the picker without selecting any files.
}
});
The pickMultipleFilesAsync function passes to the next callback—the code you pass to function
then —the list of files that the user may have selected. You can gain access to all files by running a
loop over the list.
Note that the application has read/write access to any files referenced by the file open/save pickers.
Search WWH ::




Custom Search