user3754884
user3754884

Reputation: 87

CKFinder file Uploader not working in PHP 8.2

I had no problem with ckfinder in php version 7, but after updating the server to php 8.2, when I upload a photo through quick upload, I get the following error.

CKSource\CKFinder\Filesystem\File\UploadedFile::__construct(): Argument #1 ($uploadedFile) must be of type Symfony\Component\HttpFoundation\File\UploadedFile, array given

Do you have a solution for it?

I manually added the following commands in the FileUpload.php file:

use Symfony\Component\HttpFoundation\File\UploadedFile as UploadedFileBase;



$path = $upload['tmp_name'];
    //$pathinfo = pathinfo($path);
    $pathinfo = pathinfo($upload['full_path']);
    $basename = $pathinfo['basename'];



$upload_File = new UploadedFileBase(
            $path,
            $basename,
            $upload['type'],
            $upload['error']
        );

$uploadedFile = new UploadedFile($upload_File, $this->app);

The error was changed, but the problem was not resolved.

Upvotes: 0

Views: 304

Answers (1)

user3754884
user3754884

Reputation: 87

This problem is solved in CKFinder 3.7.0:

 // Extra check to handle older Symfony components on PHP 8.1+.
    if (\is_array($upload)) {
        $upload = new UploadedFileBase($upload['tmp_name'], $upload['name'], $upload['type'], $upload['error'], false);
    }

Upvotes: 0

Related Questions