Queue FileUpload(s) for large data (videos/images)

I have run into a situation that I have searched far and wide but can't see an answer for. Imagine you need to upload a 100MB video to your S3 bucket via the FileUpload component. This will upload say up to 80MB to S3 before the server gateway response times out with a 504. Instead of having this happen directly in the request, is there an obvious way we can queue uploads and job them from this component? Or chunk the uploads somehow? I've tried doing this locally by sending the following snippet to the job, but I'm hit with serialization errors that are related to both the $file and $component.
$this->saveUploadedFileUsing(static function (BaseFileUpload $component, TemporaryUploadedFile $file): ?string {
try {
if (!$file->exists()) {
return null;
}
} catch (UnableToCheckFileExistence $exception) {
return null;
}

// dispatch rest of logic in job
Job::dispatch($file, $component);

// Error: Serialization of 'Closure' is not allowed
$this->saveUploadedFileUsing(static function (BaseFileUpload $component, TemporaryUploadedFile $file): ?string {
try {
if (!$file->exists()) {
return null;
}
} catch (UnableToCheckFileExistence $exception) {
return null;
}

// dispatch rest of logic in job
Job::dispatch($file, $component);

// Error: Serialization of 'Closure' is not allowed
Not a whizz kid with Livewire, so if anyone can help out that would be amazing. I imagine this is a problem a lot of people have run into, any answers appreciated.
4 Replies
Josh777
Josh7779mo ago
Hey @Ricardo Sawir, I've been doing some digging and came across your PR https://github.com/filamentphp/filament/pull/7036 Looks really good! Are you still waiting on this Livewire PR to be merged before proceeding? https://github.com/livewire/livewire/pull/5959
GitHub
Add chunk uploads support to FileUpload by sawirricardo · Pull Requ...
Chunk Uploads can be useful when the end users are required to upload files bigger than the server's capacity limit. This PR adds chunk upload functionality, using FilePond's chunking confi...
GitHub
Add multipart upload to Livewire's FileUpload by sawirricardo · Pul...
Review the contribution guide first at: https://laravel-livewire.com/docs/2.x/contribution-guide 1️⃣ Is this something that is wanted/needed? Did you create a discussion about it first? #5917 2️⃣ D...
Ricardo Sawir
Ricardo Sawir9mo ago
If you use s3, you can set livewire temporary upload to s3 instead of local before I tried to make a pr uses chunk upload, but it was a bit hacky since I uses multipleUpload... and it also relies to local only driver
macy
macy8mo ago
Hi @Josh777, Did you find a way out for the same?
Ivan K
Ivan K7mo ago
How about that?
Want results from more Discord servers?
Add your server
More Posts
How to control order of images in spatie media library field while saving?I have a SpatieMediaLibraryFileUpload field for images in my Filament resource. It's multiple. When image uploader to fill problemHi, i'm trying to fill image uploader from model. This is model return; `attributes: array:11 [▼ Display count of relationship in table column where pivot value = somethingHi, I need to access the many to many relationship of a model in a column and display the count of Custom Action that calls "save" doesn't actually save the modelSo I'm trying to put a save button elsewhere in an Edit page ``` Grid::make('card_payment') ->viInteract with input state and events using AlpineI'm trying to create a custom Radio input that would allow to render another text input next to optirecordSelectSearchColumns on GetRelationHello friends, I have a question, I'm in a get relation and I want in an attach action to do a searcHow to make two column section using grid?Hello everyone, I just want to ask how do I make a 2 column section using grid? I have set the columFileUpload download/preview file from private storageHi, is it possible to simply download a file from private storage? I've tried this, but this doesn'Resume Supported Form like Tax submission or Visa Application formI want to make a huge form with almost 10 tables. Initially I want to create a small table like projMax excution timeoutsI tried a fresh Laravel install and did the first Getting Started steps. When I try to go to /admin/