I am using Auth laravel feature where in registration form I am uploading an image but it is not working(showing validation error)
RegisterController.php
protected function create(array $data)
{ $request = request();
$profileImage = $request->file('image');
$profileImageSaveAsName = time() . Auth::id() . "-profile." .
$profileImage->getClientOriginalExtension();
$upload_path = public_path('img/');
$profile_image_url = $upload_path . $profileImageSaveAsName;
$success = $profileImage->move($upload_path, $profileImageSaveAsName);
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'image' => $profile_image_url,
]);
}
}
Choose Image
@if ($errors->has('file'))
<span class="help-block">
<strong></strong>
</span>
@endif
I expected file name to be uploaded in my mysql database as string but it is not uploading file through form
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Fs6EtN
via IFTTT
Aucun commentaire:
Enregistrer un commentaire