質問編集履歴
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -215,3 +215,83 @@
|
|
215
215
|
]
|
216
216
|
|
217
217
|
```
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
## 追記
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
以下の記事を参考にajax通信でやってみると送信されていました。
|
228
|
+
|
229
|
+
http://tech.aainc.co.jp/archives/10714
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
```
|
234
|
+
|
235
|
+
methods: {
|
236
|
+
|
237
|
+
async send() {
|
238
|
+
|
239
|
+
const formData = new FormData()
|
240
|
+
|
241
|
+
formData.append('image_url', this.images[0].image_url)
|
242
|
+
|
243
|
+
const config = {
|
244
|
+
|
245
|
+
headers: {
|
246
|
+
|
247
|
+
'content-type': 'multipart/form-data',
|
248
|
+
|
249
|
+
},
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
await axios.post('/*****', formData, config)
|
254
|
+
|
255
|
+
},
|
256
|
+
|
257
|
+
},
|
258
|
+
|
259
|
+
```
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
```
|
264
|
+
|
265
|
+
[2020-07-22 23:52:26] local.INFO: Array
|
266
|
+
|
267
|
+
(
|
268
|
+
|
269
|
+
[image_url] => Illuminate\Http\UploadedFile Object
|
270
|
+
|
271
|
+
(
|
272
|
+
|
273
|
+
[test:Symfony\Component\HttpFoundation\File\UploadedFile:private] =>
|
274
|
+
|
275
|
+
[originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => スクリーンショット 2020-07-14 12.23.11.png
|
276
|
+
|
277
|
+
[mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
|
278
|
+
|
279
|
+
[error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
|
280
|
+
|
281
|
+
[hashName:protected] =>
|
282
|
+
|
283
|
+
[pathName:SplFileInfo:private] => /tmp/phpWYMY1n
|
284
|
+
|
285
|
+
[fileName:SplFileInfo:private] => phpWYMY1n
|
286
|
+
|
287
|
+
)
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
)
|
292
|
+
|
293
|
+
```
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
ajax使わないでやるパターンはなぜアップロードを認識できていないのか...何が違うのか...
|
1
お試し
test
CHANGED
File without changes
|
test
CHANGED
@@ -163,3 +163,55 @@
|
|
163
163
|
|
164
164
|
|
165
165
|
```
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
試しに、hiddenでimage_urlを追加してみましたがダメでした...
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
<input type="hidden" :name="'images[' + index + '][component_type]'" :value="image['component_type']" />
|
176
|
+
|
177
|
+
<input type="hidden" :name="'images[' + index + '][image_url]'" :value="image['image_url']" />
|
178
|
+
|
179
|
+
```
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
object Fileになっているので、name属性はfile inputに指定しないといけないみたいです...
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
"images" => array:3 [▼
|
190
|
+
|
191
|
+
0 => array:3 [▼
|
192
|
+
|
193
|
+
"component_type" => "3"
|
194
|
+
|
195
|
+
"image_url" => "[object File]"
|
196
|
+
|
197
|
+
]
|
198
|
+
|
199
|
+
1 => array:3 [▼
|
200
|
+
|
201
|
+
"component_type" => "3"
|
202
|
+
|
203
|
+
"image_url" => "[object File]"
|
204
|
+
|
205
|
+
]
|
206
|
+
|
207
|
+
2 => array:3 [▼
|
208
|
+
|
209
|
+
"component_type" => "3"
|
210
|
+
|
211
|
+
"image_url" => "[object File]"
|
212
|
+
|
213
|
+
]
|
214
|
+
|
215
|
+
]
|
216
|
+
|
217
|
+
```
|