webplusmultimedia / filament-json-media

a media library base on json field with custom properties + Galleries on front-end
https://filamentphp.com/plugins/webplusm-json-media
MIT License
9 stars 2 forks source link

[Bug]: Argument #1 must be of type array, Livewire\Features\SupportFileUploads\TemporaryUploadedFile given #12

Closed baraakhateeb closed 4 months ago

baraakhateeb commented 4 months ago

What happened?

I encountered an issue where the GalleryJsonMedia package is expecting an array of files, but it is receiving a TemporaryUploadedFile object from Livewire.

How to reproduce the bug

Here's the code that I have used:

JsonMediaGallery::make('images') ->directory('tasks') ->reorderable() ->preserveFilenames() ->maxSize(5 * 1024) ->replaceNameByTitle() ->image() ->downloadable() ->deletable();

I am getting the following error:

GalleryJsonMedia\Form\JsonMediaGallery::GalleryJsonMedia\Form\{closure}(): Argument #1 ($file) must be of type array, Livewire\Features\SupportFileUploads\TemporaryUploadedFile given

Package Version

2.2

PHP Version

8.3.6

Laravel Version

10.29

Which operating systems does with happen with?

Linux

Notes

No response

webplusmultimedia commented 4 months ago

did you cast images field to array ? If not, that's why.

webplusmultimedia commented 4 months ago

Finally test with 8.3 in L11 and still ok. So see the recommandation for casting in array