I am trying to post an image to my front end page but when I click the post button I get an error

Image source not readable

private function handleRequest($request)
{
    $data = $request->all();

    if ($request->hasFile('image'))
    {
        $image          = $request->file('image');
        $fileName       = $image->getClientOriginalName();            
        $destination    = $this->uploadPath;

        $successUploaded = $image->move(public_path('img'.$fileName));
        //$successUploaded = $image->move($destination, $fileName);

        if ($successUploaded)
        {
            $extension      = $image->getClientOriginalExtension();
            $thumbnail      = str_replace(".{$extension}", "_thumb.{$extension}", $fileName);


            Image::make($destination . '/' . $fileName)
                ->resize(250, 170)
                ->save($destination . '/' . $thumbnail);
        }

        $data['image'] = $fileName;
    }

    return $data;
 }

0 Answers