How to upload multiple Files with getUploadedFiles()

Hi

I’m trying to upload multiple files but I see that getUploadedFiles() only gets one file.

This is my code:

 $files = $request->getUploadedFiles();

 var_dump($files);
 die();

And I’m using Postman like this example (https://i.stack.imgur.com/kAIrb.png) and choosing several files

Thanks in advance!

Hi @josvan did you figure this out?

Same thing was happening to me when i had input set like this:
<input type="file" name="gallery" multiple="multiple">
fix was to add “[]” behind name:
<input type="file" name="gallery[]" multiple="multiple">

now getUploadedFiles() shows more than one file,
hope it helps somebody :slight_smile:

1 Like

You have to set the Content-type of the message as multipart/form-data