#Fileupload with default value

3 messages · Page 1 of 1 (latest)

proud cobalt
#

Hey I just wondering if there a work around for Fileupload to have default value base on param that pass via the url ?

peak coyote
#

use hook instead, so if user is not providing any files, it will be handled by the hook

https://filamentphp.com/docs/3.x/panels/resources/creating-records#lifecycle-hooks

in your case it might be

Lifecycle hooks
Hooks may be used to execute code at various points within a page’s lifecycle, like before a form is saved. To set up a hook, create a protected method on the Create page class with the name of the hook:

{
    // ...
}```

and for editing is 
https://filamentphp.com/docs/3.x/panels/resources/editing-records#lifecycle-hooks

protected function beforeSave(): void
{
// ...
}