DaveVL's avatar

getRealPath() returns false

Hi,

When I use getRealPath() it returns false. I use intervention image to upload my images. Here is my controller:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Intervention\Image\ImageManagerStatic as Image;
use Illuminate\Support\Facades\Input;

class UserController extends Controller
{

    public function __construct()
    {
        $this->middleware('auth');
    }

    public function uploadAvatar(Request $request) {

        $file = Input::file('file');
        $filename  = time() . '.' . $file->getClientOriginalName();
        $path = public_path('img/uploads/avatars/' . $filename);

        Image::make($file->getRealPath())->resize(200, 200)->save($path);
    }       
0 likes
0 replies

Please or to participate in this conversation.