protonemedia / laravel-splade

💫 The magic of Inertia.js with the simplicity of Blade 💫 - Splade provides a super easy way to build Single Page Applications (SPA) using standard Laravel Blade templates, and sparkle it to make it interactive. All without ever leaving Blade.
https://splade.dev
MIT License
1.47k stars 111 forks source link

Filepond multiple upload with Spatie media library keeps only the first file #540

Closed romain-lgr closed 7 months ago

romain-lgr commented 11 months ago

Description:

When uploading multiple files using Filepond and Spatie media library, only the first file is saved - only when the model had no files already attached.

Steps To Reproduce Issue:

  1. The model has no files attached for a collection.
  2. I upload multiple files, only the first file is saved. (The variable $isMultipleField in the function syncMediaLibrary() returns false, $keys returns "images")

If the model already had files attached, then it works as expected. (The variable $isMultipleField in the function syncMediaLibrary() returns true, $keys returns "images.*")

My input field code:

<x-splade-file :label="__('label.images')" name="images[]" multiple preview filepond />

My controller code:

HandleSpladeFileUploads::syncMediaLibrary($request, $product, 'images', 'images');

pascalbaljet commented 7 months ago

Related to #475, let's continue there.

bardolf69 commented 7 months ago

@pascalbaljet How is this the same as #475 that issue was caused by the user not including an array into their file input both @romain-lgr and myself #556 are using an array as our file input and all the images are being sent to the backend (for me at least) The problem we are facing is that HandleSpladeFileUploads is not storing more than a single file.