try change this
<input name="files[]" type="file" multiple>
ddi($request->files) in the controller to check what you got
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am not sure if the issue is in the PHP side or maybe the JS only sends one file.
I have a simple form for uploading files:
<form enctype="multipart/form-data">
<input name="files" type="file" multiple>
<input type="button" value="Upload" />
</form>
Then the ajax:
$.ajax({
// Your server script to process the upload
url: '/upload',
type: 'POST',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
// Form data
data: new FormData($('form')[0]),
// .. rest of the ajax ..
In the Controller, it always shows as if there is only 1 file in the $request when I dd the request.
I am not sure if the issue is from JS or because the following store method supports only single file uploads:
$path = $request->file('files')->store('folder')
Is the issue coming from the JS part? Or it's the store method that can support only single file uploads?
try change this
<input name="files[]" type="file" multiple>
ddi($request->files) in the controller to check what you got
Please or to participate in this conversation.