Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vainway 's avatar

Filepond in livewire with alpine.js

I integrated filepond in my project, am getting a problem when I upload a file it doesn't show its progress from 1 % to 100% but other things work well and the image view also with no problem.

livewire/filepond.blade.js

<div class="row"> 
            <div class="col-md-12">
                <div 

                wire:ignore

                x-data 
                
                x-init="

                FilePond.registerPlugin(FilePondPluginImagePreview);

                FilePond.setOptions({
                    AllowMultiple: 'multiple' ? 'true' : 'false',
                    server: {
                        process: (fieldName, file, metadata, load, error, progress, abort, transfer, options) => {
                            @this.upload('uploadedFiles', file, load, error, progress)
                            
                        },
                        revert: (filename, load) => {
                            @this.removeUpload('uploadedFiles', filename, load)
                        },
                    },
                });

                FilePond.create($refs.input);

                " 
                >
                    <label>File Upload</label>
                    <input type="file" x-ref="input" wire:mode="uploadedFiles" multiple>
                </div>
            </div>
        </div>

I got all this from this video: https://laravel-livewire.com/screencasts/s5-integrating-with-filepond

0 likes
29 replies
Sinnbeck's avatar

@vainway Ah dang. I will fix it as soon as I have a chance. Thanks for the info :)

vainway 's avatar

@Sinnbeck your demo is working now but I need to use filepond and features like pintura image editors and your demo is cool too I can use it in my next project, help me solve this one

Sinnbeck's avatar

@vainway ok. I have never used it, but maybe the progress function you are passing isn't doing it the correct way?

vainway 's avatar

@Sinnbeck before integrating it with livewire the progress function was working well

vainway 's avatar

@Sinnbeck if you not a sponsor you're only allowed to watch it once not twice but still watch it am not a sponsor too.

mufarooq3's avatar

Hi @vainway did you succeed in what you were trying to achieve, i am getting a same issue like yours.

migsAV's avatar

@vainway Two things:

First - you mentioned livewire/filepond.blade.js, was that a spelling error or is that your actual file?

Second - you have a spelling error by model

<input type="file" x-ref="input" wire:mode="uploadedFiles" multiple>
vainway 's avatar

@migsAV bro its just a typo I wrote while posting I didn't have a look at it well that's why but it has nothing to do withit

migsAV's avatar

@vainway I understand but if we are giving wrong information we cannot always help

vainway 's avatar

@migsAV what are you trying to say on local and production environment am getting confused about it and <input type="file" x-ref="input" wire:mode="uploadedFiles" multiple> was just a typo I made by posting I changed it a long time ago

migsAV's avatar

@vainway I'm asking because your code showed the progress percentage on my side and then I tested a slower connection and then it did not show, I cannot explain why.

I tested it by going to the browser's dev tool and then going to Network, and chose a slower connection.

vainway 's avatar

@migsAV so you mean am having a slower connection only there is no problem behind it except my connection but I kinda agree with u like my forms be working too slow every time I add a wire:model on every input and I did my research on it, they be saying : didn't have a local mysql server, instead had a sql server hosted externally on a server on the other side of the world 😬 this the comment I got on the problem of livewire being too slow but I have no idea on how to change or I install a new xampp to fix it

vainway 's avatar

@shaungbhone I tried using what's in the link you gave me but his method is on working for me

<div
    wire:ignore
    x-data
    x-init="() => {
        const post = FilePond.create($refs.input);
        post.setOptions({
            server: {
                process:(fieldName, file, metadata, load, error, progress, abort, transfer, options) => {
                    @this.upload('{{ $attributes->whereStartsWith('wire:model')->first() }}', file, load, error, progress)
                },
            }
        });
    }"
>
    <input type="file" x-ref="input" wire:model="uploadedFiles" />
</div>

am getting this error

Error
Call to a member function whereStartsWith() on null (View: 
vainway 's avatar

@shaungbhone I have never used attributes before so it's like reading a newspaper to me reading that laravel doc, each time I use {{ $attributes }} I get errors

Please or to participate in this conversation.