© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•4mo ago•
16 replies
earendil88

Alpine Expression Error: fileUploadFormComponent when loading page first time

What I am trying to do:
Load a form with FileUpload field in an existing Laravel app (using only forms/tables, not the full panel)
Using Filament v3 due to conflicting dependencies with other plugins.

My issue / error:
On first page load, a default HTML upload button appears. Selecting a file shows an error on submit: nothing selected.
Console: Alpine Expression Error: fileUploadFormComponent is not defined

Refreshing the page enables drag-and-drop and the form works. But next login requires refresh again.

What I did:
Installed Filament Forms v3
Updated files per docs
Separated loading Filament and Datatables to avoid Alpine double-init
Tried moving app.js before/after @filamentScripts

Code:
importing filamentScripts in app.blade before closing body tag with:
@filamentScripts
@vite('resources/js/app.js')

Component code:
class PdfToExcel extends Component implements HasForms
{
    use InteractsWithForms;
    public ?array $data = [];
 
    public function mount(): void
    {
        $this->form->fill();
    }
 
    public function form(Form $form): Form
    {
        return $form
            ->schema([
                FileUpload::make('file')
                    ->label(__('Choose File'))
                    ->acceptedFileTypes(['application/pdf'])
                    ->storeFiles(false)
                    ->required(),
            ])->statePath('data');
    }
}
class PdfToExcel extends Component implements HasForms
{
    use InteractsWithForms;
    public ?array $data = [];
 
    public function mount(): void
    {
        $this->form->fill();
    }
 
    public function form(Form $form): Form
    {
        return $form
            ->schema([
                FileUpload::make('file')
                    ->label(__('Choose File'))
                    ->acceptedFileTypes(['application/pdf'])
                    ->storeFiles(false)
                    ->required(),
            ])->statePath('data');
    }
}


Blade:
<div>
    <form wire:submit="send" class="default-form import min-w-96">
        {{ $this->form }}
       
        <button type="submit" class="button primary mt-3">
            {{ ucfirst(__('submit')) }}
        </button>
    </form>
   
    <x-filament-actions::modals />
    @livewire('notifications')
</div>
<div>
    <form wire:submit="send" class="default-form import min-w-96">
        {{ $this->form }}
       
        <button type="submit" class="button primary mt-3">
            {{ ucfirst(__('submit')) }}
        </button>
    </form>
   
    <x-filament-actions::modals />
    @livewire('notifications')
</div>
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Alpine Expression Error: error is not defined when using fileupload
FilamentFFilament / ❓┊help
2y ago
Alpine Expression Error: table is not defined
FilamentFFilament / ❓┊help
9mo ago
Issue with some plugins, Alpine Expression Error
FilamentFFilament / ❓┊help
3y ago
Relation Manager Alpine Expression Error: selectedRecords is not defined
FilamentFFilament / ❓┊help
17mo ago