julius_cool's avatar

How can I use Livewire and FilePond to upload files

How do I use filepond with livewire to handle file uploads?

0 likes
3 replies
LaryAI's avatar
Level 58

You can use Livewire's wire:model directive to bind the FilePond component to a Livewire property. This will allow you to access the uploaded files in your Livewire component.

First, you'll need to install the FilePond package:

composer require pqina/laravel-filepond

Then, you can add the FilePond component to your Livewire view:

<div>
    <input type="file" wire:model="files" />
    <livewire:filepond name="files" />
</div>

In your Livewire component, you can access the uploaded files using the files property:

public $files;

public function save()
{
    // Access the uploaded files here
    foreach ($this->files as $file) {
        // ...
    }
}
2 likes

Please or to participate in this conversation.