F
Filament7mo ago
TK

getUploadedFileNameForStorageUsing() on FileUpload::configureUsing() does not work :S

Using ->getUploadedFileNameForStorageUsing() when defining defaults for file uploads, does not work. So, doing this inside the AppServiceProvider does not work:
namespace App\Providers;

FileUpload::configureUsing(function (FileUpload $component): void {
$component->getUploadedFileNameForStorageUsing(
function (TemporaryUploadedFile $file): string {
...
},
);
});
namespace App\Providers;

FileUpload::configureUsing(function (FileUpload $component): void {
$component->getUploadedFileNameForStorageUsing(
function (TemporaryUploadedFile $file): string {
...
},
);
});
Not sure why this specifically is for ->getUploadedFileNameForStorageUsing(). I think it would be nice defining a default way files are stored globally, instead of doing this on all FileUpload::make() everywhere. Note, using the exact same function on Fileupload::make()->getUploadedFileNameForStorageUsing(), does work! Anyone got an idea? Is this a bug?
2 Replies
phydeaux
phydeaux7mo ago
It's not working for me in a FileUpload::make()->getUploadedFileNameForStorageUsing setup. It was working prior to updating all my packages on Thursday morning. I saw @Dan Harrin's post about the documentation change regarding the security implications (https://discord.com/channels/883083792112300104/883253450207543327/1242213847813718066) but it didn't seem like there were any code changes happening along with it.
TK
TKOP6mo ago
Not sure why it isn't working on your end when using ->getUploadedFileNameForStorageUsing() directly inside the Resource. Probably something with your FileSystem configuration. I know for a fact it works. My problem is that I can't define it globally using FileUpload::configureUsing(), so all FileUploads work like that.
Want results from more Discord servers?
Add your server