instead of
request()->$image->move(public_path('images/users'), $filename);
use
$image->move(public_path('images/users')', $fileName);
I want to upload an image with laravel 5.8
I use this codes
if (Input::file('image')) {
And
if($request->has('image')) {
but it is not working. Call to a member function move() on null
if($request->has('image')) {
$image = $request->file('image');
$filename = $image->getClientOriginalName();
request()->$image->move(public_path('images/users'), $filename);
$user->image = $request->file('image')->getClientOriginalName();
}
@IRANKHOSRAVI - Well that it will work in insert form
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
but use this in when you are updating a user
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email,'.$user->id],
you do not want a validation error to be thrown because the user is already the owner of the e-mail address
Please or to participate in this conversation.