Level 16
Checkout this thread from stackoverflow - Laravel Livewire queues Serialization is not allowed
Hi guys, im having trouble passing uploaded file(image) to one of my queue worker. I keep receiving an error of
Serialization of 'Illuminate\\Http\\UploadedFile' is not allowed
Which if I understand correctly that I need to store my uploaded file to the storage, fetch it and then pass it to one of my queue worker. But how can I do it correctly? Thank you so much
Filesystem.php
'returnitem' => [
'driver' => 'local',
'root' => storage_path('app/public/returnitem'),
'url' => env('APP_URL'). '/storage/returnitem',
'visibility' => 'public'
],
One of my controller
if (!$request->hasFile('image')) {
return response()->error('Please provide an image file', 400);
}
if (!$request->file('image')->isValid()) {
return response()->error('Invalid file', 422);
}
$imageName = $request->file('image')->getClientOriginalName(); // get file name
$storedImage = $request->file('image')->storeAs($request->user()->uuid,$imageName, 'returnitem'); // store uploaded file to storage
$imageUrl = Storage::disk('returnitem')->url($storedImage);
$content = Storage::get('public/returnitem/'.$storedImage);
and one of my queue worker
event(new LenderPaymentRequestEvent($variable1, $variable2, $variable3, $variable3, $content));
Please or to participate in this conversation.