Help, Setting runtime config only for one FileUpload

Hi firends, Here I have a FileUpload that is setupped to work with S3 pre-signed links and I need to change the livewire's temp dir disk to be one. So my idea is to have FileUpload component extended and set the config runtime value there:
Class S3FileUpload Extends FileUpload
{
protected function setUp(): void
{
parent::setUp();
config(['livewire.temporary_file_upload.disk' => 's3']);
}

}
Class S3FileUpload Extends FileUpload
{
protected function setUp(): void
{
parent::setUp();
config(['livewire.temporary_file_upload.disk' => 's3']);
}

}
but how to get it back to the default after components finished rendering/executing so no conflict or overide will happen if I have 1 S3FileUpload field and next to it i have a regular FileUpload? Any idea how to handle this?
3 Replies
Dennis Koch
Dennis Koch7mo ago
I don't think that will work I don't think there is a difference between those two FileUpload requests. They both just upload a file via Livewire.
Dimitar Papazov DEV
Yes they do, the diffrence will be in using them:
Forms\Components\S3FileUpload::make('image')
->label('Image to be uploaded to s3 via S3 presigned urls, meaning, livewire temp dir needs to change')
->disk('s3')
->directory('category/index')
// only here I need the livewire temp dir to be changed only for this ocmponents execution
->image(),

Forms\Components\FileUpload::make('image')
->label('Image to be uploaded to local disk')
->disk('uploads')
->directory('category/images')
->image(),

Forms\Components\S3FileUpload::make('image')
->label('Image to be uploaded to s3 via S3 presigned urls, meaning, livewire temp dir needs to change')
->disk('s3')
->directory('category/index')
// only here I need the livewire temp dir to be changed only for this ocmponents execution
->image(),

Forms\Components\FileUpload::make('image')
->label('Image to be uploaded to local disk')
->disk('uploads')
->directory('category/images')
->image(),

Any idea how to approach this?
Dennis Koch
Dennis Koch7mo ago
No. As I said: I don't think it's possible with the current way Livewire uploads work
Want results from more Discord servers?
Add your server