Access form field values within saveUploadedFileUsing()

I am attempting to intercept file upload saving using saveUploadedFileUsing(). I need to access some form field values that are part of the same form. How do I do this? I've tried various uses of $set as suggested by ChatGPT but getting nowhere. FileUpload::make('file') ->directory(fn (callable $get) => 'data/photos/large') ->getUploadedFileNameForStorageUsing(fn ($file) => 'photo_' . uniqid() . '.' . strtolower($file->getClientOriginalExtension())) ->saveUploadedFileUsing(callback: function ($file, $record, $set) { # how do I access the other form field values here? })->disk('s3') ->required(),
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?