FilamentF
Filament10mo ago
sohail

Create Custom Form Field (Image Selector)

Hi

i am trying to create a custom form field which let so select for a preloaded image and also upload your own image and this is how i want the input to work

ImageSelector::make('thumbnail')
                ->images($this->thumbnails) // array of preload image


i have add so you can see the image from the thumbnail array and pass back but what i can figure out and how the user can upload the image
i tried and what i get back as a temp livewire file but i want the actual upload the image and get it back on the path to the image

plus is there a way i can do some validation after the image have be uploaded because some of the validation i dont want to do over and over again every where i use this
i would like to do those directly in the component

  • make sure the selected image is form the array
  • make sure the actual uploaded image is a image
<input type="file" wire:model="{{ $getStatePath }}">
Was this page helpful?