Instead of a save you need a ->move, see the file documentation.
Edit see https://laravel.com/docs/5.4/requests#storing-uploaded-files
I guess 5.4 has ->store, I use 5.1 still in production
namespace App\Http\Controllers;
use Illuminate\Http\Request; use Auth; use Image; class UserController extends Controller { public function profil(){ return view('profile',array('user'=> Auth::user())); }
public function updateavatar(Request $request){
// Handle the user upload of avatar
if($request->hasFile('avatar')){
$avatar = $request->file('avatar');
$filename = time().'.'.$avatar->getClientOriginalExtension();
Image::make($avatar)->save( public_path('/uploads/avatars/'.$filename ) );
$user = Auth::user();
$user->avatar = $filename;
$user->save();
return view('profile',array('user'=> Auth::user()));
}
}
} i have installed intervention image on my project and set all configurations , i want to upload an image for my user profil but i got an error when i submit the form : FatalThrowableError in UserController.php line 19: Class 'Image' not found any suggestion please ??
Please or to participate in this conversation.