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?
3 Replies
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Mark Chaney
Mark Chaney16mo ago
Didn’t work. Don’t think it will because it’s not storing the file, my code is. I have storeFile set to false, the code I listed is doing the save
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View