回答編集履歴

2

修正

2019/08/10 03:29

投稿

退会済みユーザー
test CHANGED
@@ -126,7 +126,7 @@
126
126
 
127
127
  $.each(e.target.files, function (i, item) {
128
128
 
129
- upfiles[upfiles.length] = item;
129
+ upfiles.push(item);
130
130
 
131
131
  });
132
132
 

1

追記

2019/08/10 03:29

投稿

退会済みユーザー
test CHANGED
@@ -67,3 +67,79 @@
67
67
  </html>
68
68
 
69
69
  ```
70
+
71
+
72
+
73
+ ---
74
+
75
+
76
+
77
+ ```html
78
+
79
+ <!doctype html>
80
+
81
+ <html lang="ja">
82
+
83
+ <head>
84
+
85
+ <meta charset="UTF-8">
86
+
87
+ <meta name="viewport"
88
+
89
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
90
+
91
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
92
+
93
+ <title>Document</title>
94
+
95
+ </head>
96
+
97
+ <body>
98
+
99
+ <form action="" method="post">
100
+
101
+
102
+
103
+ <p>
104
+
105
+ <input id="upfiles" type="file" name="upfiles" multiple>
106
+
107
+ </p>
108
+
109
+
110
+
111
+ </form>
112
+
113
+ <script src=""></script>
114
+
115
+ <script src="https://code.jquery.com/jquery-3.4.1.min.js"
116
+
117
+ integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
118
+
119
+ <script>
120
+
121
+ $(function () {
122
+
123
+ let upfiles = [];
124
+
125
+ $('#upfiles').on('change', function (e) {
126
+
127
+ $.each(e.target.files, function (i, item) {
128
+
129
+ upfiles[upfiles.length] = item;
130
+
131
+ });
132
+
133
+ console.log(upfiles.length);
134
+
135
+ });
136
+
137
+ });
138
+
139
+ </script>
140
+
141
+ </body>
142
+
143
+ </html>
144
+
145
+ ```