php - Image file not being stored in laravel project -


hello guys need guys. creating laravel project have modified default users table store more informations of users name , user image file name. had modify 'registercontroller' class 'create' function has been modified , have added 'update' method store uploaded image file. below code of 'registercontroller' class:

    protected function update(array $data) {     $path = $data['img']->storeas('/public','ohgod  ');     return $path; }   protected function create(array $data) {      $filename;           $filename = $data['img']->getclientoriginalname();         $filesize = $data['img']->getclientsize();         $this->update($data);       return user::create([         'name' => $data['name'],         'img_name' => $filename,         'img_size' => $filesize,         'username' => $data['username'],         'dob' => $data['dob'],         'email' => $data['email'],         'password' => bcrypt($data['password']),     ]); } 

with had modify form add informations of user. , when register new user.i every thing right in users table image file not stored in server.

i new in laravel don't know whats wrong code. haven't got error messages. me guys.

i got file storing code official site of laravel https://laravel.com/docs/5.5/filesystem

you have move image folder before inserting db

 $destinationpath='images';        $filename = $data['img']->getclientoriginalname();          //move iamge folder         $filename = str_random(30).'.'.$data['img']->clientextension();         $data['img']->move($destinationpath, $filename); 

moved file available in public/images folder


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -