Ara's avatar
Level 3

File upload using queue

Hi guys,

I am trying to queue a file upload but I am running into an error. Here is my code:

$file = $request->file('file');
            $path = '/some/path/file.pdf';

            $this->dispatch(new PDFUploadJob($file, $path));

And in my handle method of the job:

public function handle ()
    {
        Storage::disk('s3')->put($this->path, file_get_contents($this->file));
    }

If I remove the ShouldQueue trait, it works fine. But when I add the trait, I get: Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed

Any ideas on what I am doing wrong?

Thanks, Ara

0 likes
1 reply
SamStenton's avatar

I am also having this problem with the ShouldQueue trait. However rather than the Serialization error I get Undefined property: App\Events\AudioWasUploaded::$file

Please or to participate in this conversation.