Spatie Media Library custom file name

Is there a way to change the file name with an input text or a way to add some custom description?
2 Replies
Eugen Pașca
Eugen Pașca4mo ago
hey, @yaroslavpopovic , did you find a solution for this?
roni
roni4mo ago
This is how I did it in one of my project. ->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file, Get $get): string { $rec = $this->getOwnerRecord(); $name = (string) 'image-of-'. $rec->slug . '-' . Str::random(4). '.' . $file->getClientOriginalExtension(); return $name; })