質問するログイン新規登録

回答編集履歴

2

修正

2019/08/10 03:29

投稿

退会済みユーザー
answer CHANGED
@@ -62,7 +62,7 @@
62
62
  let upfiles = [];
63
63
  $('#upfiles').on('change', function (e) {
64
64
  $.each(e.target.files, function (i, item) {
65
- upfiles[upfiles.length] = item;
65
+ upfiles.push(item);
66
66
  });
67
67
  console.log(upfiles.length);
68
68
  });

1

追記

2019/08/10 03:29

投稿

退会済みユーザー
answer CHANGED
@@ -32,4 +32,42 @@
32
32
  </script>
33
33
  </body>
34
34
  </html>
35
+ ```
36
+
37
+ ---
38
+
39
+ ```html
40
+ <!doctype html>
41
+ <html lang="ja">
42
+ <head>
43
+ <meta charset="UTF-8">
44
+ <meta name="viewport"
45
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
46
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
47
+ <title>Document</title>
48
+ </head>
49
+ <body>
50
+ <form action="" method="post">
51
+
52
+ <p>
53
+ <input id="upfiles" type="file" name="upfiles" multiple>
54
+ </p>
55
+
56
+ </form>
57
+ <script src=""></script>
58
+ <script src="https://code.jquery.com/jquery-3.4.1.min.js"
59
+ integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
60
+ <script>
61
+ $(function () {
62
+ let upfiles = [];
63
+ $('#upfiles').on('change', function (e) {
64
+ $.each(e.target.files, function (i, item) {
65
+ upfiles[upfiles.length] = item;
66
+ });
67
+ console.log(upfiles.length);
68
+ });
69
+ });
70
+ </script>
71
+ </body>
72
+ </html>
35
73
  ```