Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

A package to use Filepond in your Livewire component

Original – by Freek Van der Herten – 2 minute read

We’ve published a new package called livewire-filepond, which contains a component to easily upload files.

Under the hood, Filepond, a powerful JavaScript library to upload files, is used.

Here's how it looks like in action in mailcoach.app (a product we built at Spatie):

Using livewire-filepond

Our package makes it very easy to use Filepond in your Livewire powered Laravel app.

After installing the package, you add the scripts to your layout or view where you want to use Filepond:

@filepondScripts

Next, add the WithFilePond trait to your component:

use Livewire\Component;
use Spatie\LivewireFilepond\WithFilePond;

class MyLivewireComponent extends Component
{
    use WithFilePond;
    
    public $file;
}

Finally, add the component to your view:

<x-filepond::upload wire:model="file" />

Optionally, you can use these component properties to customize the component:

  • multiple: Allow multiple files to be uploaded. Default: false.
  • required: Make the file input required. Default: false.
  • disabled: Disable the file input. Default: false.
  • placeholder: Placeholder text for the file input. Default: Drag & Drop your files or <span class="filepond--label-action"> Browse </span>.

Additionally, you can also pass any property that the Filepond component accepts. Make sure to use kebab case the property. For example, to set the maximum number of files to 5, you can do this:

<x-filepond::upload wire:model="file" max-files="5" />

Testing out the component

We use this package ourselves at Mailcoach, a powerful email marketing platform. To see livewire-filepond in action, you can create a free trial account.

Next create a new email list in the audience section and go the “Imports” screen. The uploader there is powered by our package.

In closing

This package was created by our team member Rias, who as always did a great job.

This isn’t the first package we’ve released. Head over to our company website to see a big list of packages we created previously.

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Comments

yepav avatar

One of the benefits to developing in a positive direction heardle online.

tegarjgap avatar

Thanks, Great Article! By the way, how to customize the filepond style drag n drop area?

NeilKeebler avatar

I like it and want to learn Merge Fruit.

Darren avatar

the integration with FilePond works well, but the customization options feel a bit limited, especially if you’re trying to make it fit a specific UI. Still, it does the job for basic uploads. scratch geometry dash

Betaf avatar

A package to use Filepond in your Livewire component is a nice detail that helps us to resolve such issues. When I contact the Adelaide Pressure Cleaning Pros I got the best results and it is the best idea to use the local services around you.

Comments powered by Laravel Comments
Want to join the conversation? Log in or create an account to post a comment.