Upload Files Using Filepond in Livewire Components
Last updated on by Paul Redmond
Filepond is a JavaScript package that allows you to upload anything, with popular integrations for React, Vue, Svelte, and more. If you're using Livewire, now you can easily use Filepond to upload files within Livewire components using Spatie's livewire-filepond package. This package contains a Livewire component that allows you to start using it in your Laravel projects easily:
use Livewire\Component;use Spatie\LivewireFilepond\WithFilePond; class MyLivewireComponent extends Component{ use WithFilePond; public $file;} // <x-filepond::upload wire:model="file" />
You can pass any property that Filepond accepts, and you can further customize the Livewire Filepond component with the following options available at the time of writing:
- Allow multiple file uploads
- Make the file upload required
- Ability to disable the upload input
- Custom placeholder text
You can learn more about this package, get full installation instructions, and view the source code on GitHub. To learn more about this project, check out Freek Van der Herten's writeup about this package.