Jul 9, 2017
0
Level 1
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);
}
Please or to participate in this conversation.