diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php index ccc0a6896..b6fb024c6 100644 --- a/app/Http/Controllers/Agent/helpdesk/UserController.php +++ b/app/Http/Controllers/Agent/helpdesk/UserController.php @@ -764,10 +764,12 @@ class UserController extends Controller if (Input::file('profile_pic')) { // fetching picture name $name = Input::file('profile_pic')->getClientOriginalName(); + // dd($name); + // dd(str_replace(" ", "_", $name)); // fetching upload destination path $destinationPath = 'uploads/profilepic'; // adding a random value to profile picture filename - $fileName = rand(0000, 9999).'.'.$name; + $fileName = rand(0000, 9999).'.'.str_replace(" ", "_", $name); // moving the picture to a destination folder Input::file('profile_pic')->move($destinationPath, $fileName); // saving filename to database diff --git a/app/Http/Controllers/Client/helpdesk/GuestController.php b/app/Http/Controllers/Client/helpdesk/GuestController.php index 0b1281d8d..d1a0afd74 100644 --- a/app/Http/Controllers/Client/helpdesk/GuestController.php +++ b/app/Http/Controllers/Client/helpdesk/GuestController.php @@ -101,7 +101,7 @@ class GuestController extends Controller // fetching upload destination path $destinationPath = 'uploads/profilepic'; // adding a random value to profile picture filename - $fileName = rand(0000, 9999).'.'.$name; + $fileName = rand(0000, 9999).'.'.str_replace(" ", "_", $name); // moving the picture to a destination folder Input::file('profile_pic')->move($destinationPath, $fileName); // saving filename to database diff --git a/app/User.php b/app/User.php index d6d573d21..1ce1abfa8 100644 --- a/app/User.php +++ b/app/User.php @@ -46,7 +46,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon } if (!$pic && $value) { $pic = ""; - $file = public_path('uploads/profilepic/' . $value); + $file = asset('uploads/profilepic/' . $value); if ($file) { $type = pathinfo($file, PATHINFO_EXTENSION); $data = file_get_contents($file);