© 2026 Hedgehog Software, LLC
Forms\Components\TextInput::make('url') ->label('URL') ->url() ->dehydrated(false) ->live(onBlur: true) ->suffixAction( Forms\Components\Actions\Action::make('downloadFile') ->icon('heroicon-m-arrow-down-tray') ->action(function ($record, Get $get, Set $set, $state, \Filament\Forms\Components\Component $component) { $contents = file_get_contents($state); $fileName = Str::ulid(); $extension = pathinfo($state, PATHINFO_EXTENSION); $fileNameWithExtension = $fileName . '.' . $extension; $filePath = 'livewire-tmp/' . $fileNameWithExtension; // $SpatieMediaLibraryFileUpload = $component->getContainer()->getComponent(fn ($childComponent) => $childComponent->getName() === 'media'); $storage = Storage::disk('local'); $storage->put($filePath, $contents); $tempFile = TemporaryUploadedFile::createFromLivewire($fileNameWithExtension); $media = $get('media'); $media[Str::uuid()->toString()] = $tempFile; $set('media', $media); $set('url', null); }) )