foreach ($request->file[‘image’] as $file) { // try here ]);
Use this as reference https://appdividend.com/2018/02/05/laravel-multiple-images-upload-tutorial/
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
@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)
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community