'ErrorException Array to string conversion-Laravel 8

Am trying to upload files on my laravel project but getting an error 'ErrorException Array to string conversion'

Any help will be much appreciated. Below is the error

ErrorException Array to string conversion

C:\xampp\htdocs\laravel\filesUpload\vendor\laravel\framework\src\Illuminate\Support\Str.php:609

    /**
     * Replace a given value in the string sequentially with an array.
     *
     * @param  string  $search
     * @param  array<int|string, string>  $replace
     * @param  string  $subject
     * @return string
     */

    public static function replaceArray($search, array $replace, $subject) 
    {
        $segments = explode($search, $subject);
        $result = array_shift($segments);

        foreach ($segments as $segment) {
            $result .= (array_shift($replace) ?? $search).$segment; //line 609
        }
 
        return $result;
    }

line 609



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source