© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
javif89

File upload in actions

Hey guys, I have a question that I couldn't really find an answer for in the docs.

I have a model with a form where you can upload an image, all of that works great. Now I'm trying to add a "Bulk upload" action that lets the user upload multiple files and it will create a new record for each file uploaded with some other fields filled out based on the file name. I have the action set up but it's a bit unclear to me how to save the files.

->action(function (array $data) {
    $records = [];

    foreach ($data['original_file_name'] as $filename => $original) {
        $name = Str::from($original)->before('.')->trim()->lower()->replace(' ', '_')->toString();
        $records[] = [
            'image_path' => $filename,
            'category_id' => $data['category_id'],
            'name' => $name,
        ];
    }
})
->action(function (array $data) {
    $records = [];

    foreach ($data['original_file_name'] as $filename => $original) {
        $name = Str::from($original)->before('.')->trim()->lower()->replace(' ', '_')->toString();
        $records[] = [
            'image_path' => $filename,
            'category_id' => $data['category_id'],
            'name' => $name,
        ];
    }
})


This is what I have so far. I'm just not sure how to save the files from here. Would appreciate any help.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

upload file
FilamentFFilament / ❓┊help
2y ago
File Upload
FilamentFFilament / ❓┊help
2y ago
File Upload
FilamentFFilament / ❓┊help
3y ago
File Upload
FilamentFFilament / ❓┊help
3y ago