© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3mo ago•
2 replies
CROK

FileUpload form field and it's default values

Hello everyone.
I have a problem with FileUpload form field on my custom page.
I get a record from secondary db with file position and i want to show it as a default value for current form field.
On this moment I made a default filament 4 resource with linked field from db to the FileUpload form field.
In result i have seen that db contains name of file and edit page shows that file as already uploaded. In thay case if i set default value as array of strings with filenames/position of the file in storage/app/private. But then i tried to made same form with same default value on my custom page then the file not appears.
Here is how i tried to made it:

app/Filament/Pages/TestForm

<?php

namespace App\Filament\Pages;

use Filament\Forms\Components\FileUpload;
use Filament\Pages\Page;
use Filament\Schemas\Schema;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;

class TestForm extends Page
{

    public function form(Schema $schema): Schema
    {
        return $schema
            ->components([
                FileUpload::make('upd')
                    ->default(['udp/thesis.txt']),
//                ->default([TemporaryUploadedFile::createFromLivewire('udp/thesis.txt')]),
            ]);
    }

    protected string $view = 'filament.pages.test-form';
}
<?php

namespace App\Filament\Pages;

use Filament\Forms\Components\FileUpload;
use Filament\Pages\Page;
use Filament\Schemas\Schema;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;

class TestForm extends Page
{

    public function form(Schema $schema): Schema
    {
        return $schema
            ->components([
                FileUpload::make('upd')
                    ->default(['udp/thesis.txt']),
//                ->default([TemporaryUploadedFile::createFromLivewire('udp/thesis.txt')]),
            ]);
    }

    protected string $view = 'filament.pages.test-form';
}


views/filament/pages/test-form.blade.php

<x-filament-panels::page>
    <form>
        {{$this->form}}
    </form>
    {{-- Page content --}}
</x-filament-panels::page>
<x-filament-panels::page>
    <form>
        {{$this->form}}
    </form>
    {{-- Page content --}}
</x-filament-panels::page>


I know that array of form data contains array TemporaryUploadFile objects and i have tried to made it to show it on the FileUpload field but have a same problem with not appeared file in FileUpload
Is any solution for similar cases with default value of FileUpload form field?
Or someone know where is happening transformation of the value from db(title of the file) to the TemporaryUploadFile that i can take as an example
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

FileUpload: Default values for edit Form
FilamentFFilament / ❓┊help
10mo ago
Reset only one form field into it's default state
FilamentFFilament / ❓┊help
9mo ago
FileUpload default()
FilamentFFilament / ❓┊help
3y ago
FileUpload Form Field gives unexpected error.
FilamentFFilament / ❓┊help
2y ago