© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Mark Chaney

FileUpload and Spatie

Im getting crazy long random file names like
    'V8mnV9ndlnDQS50GwoBjOltPS9ooTT-metaWFVvS3RjemVmNmhmWk9HSmExMUVqNVpZaE5VejNzLW1lWFVvS3RjemVmNmhmWk9HSmExMUVqNVpZaE5VejNzLW1ldGFORFI1WkROclNXMXJTSFoyUzFSRVoxSnRhTkRSNVpETnJTVzFyU0haMlMxUkVaMUpJTjNCeVNUTkhlVW91Y0c1bi0tMjIwdy5wbmc=-.png',
    'V8mnV9ndlnDQS50GwoBjOltPS9ooTT-metaWFVvS3RjemVmNmhmWk9HSmExMUVqNVpZaE5VejNzLW1lWFVvS3RjemVmNmhmWk9HSmExMUVqNVpZaE5VejNzLW1ldGFORFI1WkROclNXMXJTSFoyUzFSRVoxSnRhTkRSNVpETnJTVzFyU0haMlMxUkVaMUpJTjNCeVNUTkhlVW91Y0c1bi0tMjIwdy5wbmc=-.png',
when the mysql varchar length is only 191 for this particular field. Now I am doing some custom saving using
$this->tenant->clearMediaCollection('logo');
$this->tenant->addMediaFromDisk(collect($this->data['logo'])->first()->path(), config('livewire.temporary_file_upload.disk'))
    ->toMediaCollection('logo');
$this->tenant->clearMediaCollection('logo');
$this->tenant->addMediaFromDisk(collect($this->data['logo'])->first()->path(), config('livewire.temporary_file_upload.disk'))
    ->toMediaCollection('logo');
Ive tried setting a custom filename using random string both in the upload field and the save method, but no dice as it never seemed to take. I am not sure addMediaFromDisk allows filename changes before save? Any suggestions?
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

Filament Spatie FileUpload with s3
FilamentFFilament / ❓┊help
3y ago
FileUpload inside Builder with SpatieMediaLibrary and AWS S3
FilamentFFilament / ❓┊help
3y ago
Filenames and Spatie
FilamentFFilament / ❓┊help
3y ago
FileUpload And Morph
FilamentFFilament / ❓┊help
3y ago