FileUpload issue with multiple machines
I'm using the FileUpload component, to upload a files in S3.
Sample code:
When I use only one app machine i.e. vm (scaling), the upload works correctly i.e.
1. the file is uploaded correctly "storage\app\livewire-tmp" when I pick it
2. the file is uploaded to "s3" "tmp" folder when I click the Submit button
When I use multiple app machines the file gets uploaded to "storage\app\livewire-tmp", under name like 'JBexfBvW1lJgkJyjxaWYasj09aUWZ3-metaU2FsZXNfUmVwb3J0X0RFQ18yMDIzX0hleUhhcHBpbmVzc19QTC5DU1Y=-.csv' (including the single quotes, which is strange), but when I click the Submit button, it's not uploaded to the S3 folder.
In the multiple app engines case it does not work even if it's executed on the app engine on which it was previously worked perfectly (in single single engine mode)
Do you have any idea, why when adding second app engine for my application, the uploads stops working? Is there something that I have to configure additionally? Any help will be appreciated.
3 Replies
![No description](https://cdn.answeroverflow.com/1263098831407550489/del.jpg)
I found the problem.
Step #1: I pick up the file and it gets uploaded to livewire-tmp folder of machine #1
Step #2: I click the "submit" button, and the system makes the request to machine #2, trying to pick the file from the livewire-tmp folder in order to upload it to S3 "tmp" folder.
The file is not in machine #2, so it returns null:
BaseFileUpload.php
Now the question is how should I handle such a problem. Any ideas?Publish the livewire config and change the tmp directory. So it uploads them to s3 instead of local. There’s a section in the livewire docs about this.