Request all picking up only last value (LARAVEL)

Asked

Viewed 32 times

-2

I made a Function a few days ago that saved several photos at once. It worked, but when I went to use this Function again, she was just getting the last amount I was sending. Example: I sent photo1, photo2, photo3. When I gave a dd in the variable that received $request->all(), only photo3 came. Does anyone have any idea how to fix this?

  • 1

    You can add HTML + code so you can better illustrate

  • Try to add the source code of what is done so far

  • public Function saveImage(Request $request) { $image = $request->all(); $this->productService->saveImage($image); Return Response()->json('Image saved successfully!'); }

1 answer

1


Put array '[]' in the name attribute and the attribute 'Multiple' in the file tag?

<input type="file" class="form-control" name="imagens[]" multiple />

Maybe that’s the problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.