Browse Source

Update file-object.md

Added a for loop to iterate over the array of files, which allows processing of multiple files being dropped over the "holder" div.
Matt Slay 8 years ago
parent
commit
0e24d148fd
1 changed files with 3 additions and 2 deletions
  1. 3 2
      docs/api/file-object.md

+ 3 - 2
docs/api/file-object.md

@@ -24,8 +24,9 @@ Example on getting a real path from a dragged-onto-the-app file:
   };
   holder.ondrop = (e) => {
     e.preventDefault();
-    const file = e.dataTransfer.files[0];
-    console.log('File you dragged here is', file.path);
+    for (let f of e.dataTransfer.files) {
+      console.log('File(s) you dragged here: ', f.path);
+    }
     return false;
   };
 </script>