Support the ongoing development of Laravel.io →
posted 5 years ago
Lumen
Last updated 2 years ago.
0

What does

dd($request->file('image'));

return?

0

foreach ($request->file[‘image’] as $file) { // try here ]);

Use this as reference https://appdividend.com/2018/02/05/laravel-multiple-images-upl...

Also make sure your input is files[] not file

Che k the request by dd($request); that will show you if all images are coming through as an array and if you need to loop over them

Last updated 5 years ago.
0

@TorchSK I get this from Postman

UploadedFile {#95
  -test: false
  -originalName: "img4.jpeg"
  -mimeType: "image/jpeg"
  -error: 0
  #hashName: null
  path: "C:\wamp64\tmp"
  filename: "php46B3.tmp"
  basename: "php46B3.tmp"
  pathname: "C:\wamp64\tmp\php46B3.tmp"
  extension: "tmp"
  realPath: "C:\wamp64\tmp\php46B3.tmp"
  aTime: 2019-04-20 16:09:59
  mTime: 2019-04-20 16:09:59
  cTime: 2019-04-20 16:09:59
  inode: 0
  size: 51102
  perms: 0100666
  owner: 0
  group: 0
  type: "file"
  writable: true
  readable: true
  executable: false
  file: true
  dir: false
  link: false
  linkTarget: "C:\wamp64\tmp\php46B3.tmp"
}

However, I tried to upload 3 pictures (from Postman still)

Last updated 5 years ago.
0

Hi @Cameron,

dd($request->file[‘image’]) returns null unfortunately

And to make a foreach I have to be sure that $request->file(‘image’) returns an array but it doesn't. It still returns the last one file

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Ivan Hervé ivanherve Joined 14 Apr 2019

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.