Browse Source

for loops act wonky. replaced with forEach to add correct number of files.

Harry Hedger 9 years ago
parent
commit
1dc9aec102
2 changed files with 30 additions and 14 deletions
  1. 27 11
      src/plugins/Formtag.js
  2. 3 3
      website/_config.yml

+ 27 - 11
src/plugins/Formtag.js

@@ -23,17 +23,33 @@ export default class Formtag extends Plugin {
         var fields   = document.querySelectorAll(self.opts.selector);
         var files    = [];
         var selected = [];
-        for (var i in fields) {
-          for (var j in fields[i].files) {
-            var file = fields[i].files.item(j);
-            if (file) {
-              selected.push({
-                from: 'Formtag',
-                file: fields[i].files.item(j)
-              });
-            }
-          }
-        }
+
+        [].forEach.call(fields, function(field, i) {
+          [].forEach.call(field.files, function(file, j) {
+            selected.push({
+              from: 'Formtag',
+              file: file
+            })
+          })
+        });
+
+        // console.log(fields.length);
+        // for (var i in fields) {
+        //   console.log('i');
+        //   // console.log('i: ', i);
+        //   for (var j in fields[i].files) {
+        //     console.log('j');
+        //     // console.log('i, j', i, j);
+        //     console.log(fields[i].files);
+        //     var file = fields[i].files.item(j);
+        //     if (file) {
+        //       selected.push({
+        //         from: 'Formtag',
+        //         file: fields[i].files.item(j)
+        //       });
+        //     }
+        //   }
+        // }
         self.setProgress(100);
         console.log({
           selected:selected,

+ 3 - 3
website/_config.yml

@@ -5,9 +5,9 @@
 # Uppy versions, auto updated by update.js
 uppy_version: 0.0.1
 
-uppy_dev_size: "78.96"
-uppy_min_size: "78.96"
-uppy_gz_size: "78.96"
+uppy_dev_size: "79.86"
+uppy_min_size: "79.86"
+uppy_gz_size: "79.86"
 
 # Theme
 google_analytics: UA-63083-12