Oct 13, 2017
0
Level 2
Change Storage Path of User Avatar
I create the upload file avatar where the avatar should be store in storage/users/"the date time i upload"/filename.extension
but its just save the filename.extension without the storage. my UserController.php using local storage
public function update_avatar(Request $request){
// Handle the user upload of avatar
if($request->hasFile('avatar')){
$avatar = $request->file('avatar');
$filename = time() . '.' . $avatar->getClientOriginalExtension();
$avatar->move('/storage/users',$filename);
Image::make($avatar)->resize(300, 300)->move( public_path('/storage/users' . $filename ) );
$user = Auth::user();
$user->avatar = $filename;
$user->save();
}
return view('profile'.$user->username.'/account');
}
how to fixed it?
Please or to participate in this conversation.