I had this filepond instance:
<input type="file" name="files[]" class="filepond" multiple />
<script src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.js"></script>
<script src="https://unpkg.com/filepond-plugin-image-exif-orientation/dist/filepond-plugin-image-exif-orientation.js"></script>
<script src="https://unpkg.com/filepond-plugin-file-validate-type/dist/filepond-plugin-file-validate-type.js"></script>
<script src="https://unpkg.com/filepond/dist/filepond.js"></script>
<script>
const inputElement = document.querySelector('input[type="file"].filepond');
FilePond.registerPlugin(FilePondPluginImagePreview,
FilePondPluginImageExifOrientation,
FilePondPluginFileValidateType);
FilePond.create(inputElement).setOptions({
allowMultiple: true,
maxFiles: 3,
acceptedFileTypes: ['image/*'],
allowImagePreview: true,
server: {
process: '/upload/process',
revert: '/upload/remove',
load: '/upload/load/',
remove: (source, load, error) => {
$.ajax({
type:'DELETE',
url:'/upload/removelocal',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
data: { filename: source, userid: {{ auth()->user()->id }} },
});
load();
},
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
},
},
files: [
@foreach ($attachments as $attachment)
{source: '{{ $attachment->filename }}', options: {type: 'local'}},
@endforeach
],
});
I was working on this project and then stopped and started again recently. When I did, I updated everything including going from Laravel 11 to 12. Everything else works, the file initially gets copied to a tmp location (from my process function), the remove function, the prepopulate with existing images, everything, except filepond isn't including the files[] input in my post back to my Update function. The Request object has all my other fields except file[]. It used to be there. This same code worked perfectly.
My process function (/upload/process): (This is still working, the file makes it to my tmp area)
public function process(Request $request): string
{
$file = $request['files'][0];
$ext = pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
$path = $file->storeAs('tmp', now()->timestamp.'-'.Str::random(20).'.'.$ext, "private");
return $path;
}
My Controller: No sign of files/files[], which used to be there. I did change the name of the control just in case it was something to do with the name "files[]" but still same thing. This is where I would copy from tmp to it's permanent folder.
public function update(Request $request, string $id)
{
Log::Debug($request->all());
dd($request);
}
No errors in Chrome debugger console, Looking at the request post from network tab shows just the other fields on the form, not files/files[]. No errors in Laravel Log:
[2025-06-15 16:52:56] local.DEBUG: array (
'_method' => 'PUT',
'_token' => 'DxmXn00LeEZ7Qc1FqV6dFft8m4pkjTSvj7Y8N5un',
'title' => 'aaa rtfgf',
'text' => '<p>fgdfgdf</p>',
'tag_list' =>
array (
0 => '11',
),
'contact_list' =>
array (
0 => '13',
1 => '18',
),
)
Any help would be greatly appreciated! Thanks.
After much trial and error, it turned out to be malformed html on the page. an open <br caused the files input component to be "outside" of the form. So, when laravel did it's magic, it didn't see that control in the form so it didn't bundle it in my post $request. I'll leave this question though, because it is a working example of filepond, which automatically adds the tmp filename to the files input component perfectly!