title: Uploading picture in Laravel Registration
body: <p>I'm making a website where users can upload their own profile picture, with their credentials such as name, email, password, and dob using Laravel Authentication.</p>
  
  <p>After doing <code>php artisan make:auth</code> , there's this function in <code>AuthController.php</code> :</p>
  
  <pre><code>protected function create(array $data)
  {
      return User::create([
          'name' =&gt; $data['name'],
          'email' =&gt; $data['email'],
          'password' =&gt; bcrypt($data['password']),
          'dob' =&gt; $data['dob'],
          'profile_picture' =&gt; $data['profile_picture],
      ]);
  }
  </code></pre>
  
  <p>and here's my form:</p>
  
  <pre><code>&lt;form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}" enctype="multipart/form-data"&gt;
      {{ csrf_field() }}
  
      &lt;div class="form-group{{ $errors-&gt;has('email') ? ' has-error' : '' }}"&gt;
          &lt;label for="email" class="col-md-4 control-label"&gt;E-mail Address&lt;/label&gt;
          &lt;input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}"&gt;
  
          @if ($errors-&gt;has('email'))
              &lt;span class="help-block"&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('email') }}&lt;/strong&gt;
               &lt;/span&gt;
          @endif
      &lt;/div&gt;
  
      &lt;div class="form-group{{ $errors-&gt;has('password') ? ' has-error' : '' }}"&gt;
          &lt;label for="password" class="col-md-4 control-label"&gt;Password&lt;/label&gt;
          &lt;input id="password" type="password" class="form-control" name="password"&gt;
  
          @if ($errors-&gt;has('password'))
              &lt;span class="help-block"&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('password') }}&lt;/strong&gt;
              &lt;/span&gt;
          @endif
      &lt;/div&gt;
  
      &lt;div class="form-group{{ $errors-&gt;has('password_confirmation') ? ' has-error' : '' }}"&gt;
          &lt;label for="password-confirm" class="col-md-4 control-label"&gt;Confirm Password&lt;/label&gt;
          &lt;input id="password-confirm" type="password" class="form-control" name="password_confirmation"&gt;
  
          @if ($errors-&gt;has('password_confirmation'))
              &lt;span class="help-block"&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('password_confirmation') }}&lt;/strong&gt;
              &lt;/span&gt;
          @endif
      &lt;/div&gt;
  
      &lt;div class="form-group{{ $errors-&gt;has('name') ? ' has-error' : '' }}"&gt;
          &lt;label for="name" class="col-md-4 control-label"&gt;Fullname&lt;/label&gt;
          &lt;input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}"&gt;
  
          @if ($errors-&gt;has('name'))
              &lt;span class="help-block"&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('name') }}&lt;/strong&gt;
              &lt;/span&gt;
          @endif
      &lt;/div&gt;
  
      &lt;div class="form-group{{ $errors-&gt;has('dob') ? ' has-error' : '' }}"&gt;
          &lt;label for="name" class="col-md-4 control-label"&gt;Date of Birth&lt;/label&gt;
          &lt;input id="dateOfBirth" type="date" class="form-control" name="dob"&gt;
  
          @if ($errors-&gt;has('dob'))
              &lt;span class="help-block"&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('dob') }}&lt;/strong&gt;
              &lt;/span&gt;
          @endif
      &lt;/div&gt;
  
       &lt;div class="form-group{{ $errors-&gt;has('profile_picture') ? ' has-error' : '' }}"&gt;
          &lt;label for="name" class="col-md-4 control-label"&gt;Profile Picture&lt;/label&gt;
          &lt;input id="profilePicture" type="file" class="form-control" name="profile_picture"&gt;
  
          @if ($errors-&gt;has('profile_picture'))
              &lt;span class="help-block"&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('profile_picture') }}&lt;/strong&gt;
              &lt;/span&gt;
          @endif
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;button type="submit" class="btn btn-primary"&gt;
              &lt;i class="fa fa-btn fa-user"&gt;&lt;/i&gt; Register
          &lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I would like to save the image filename with its extension. But how do I do it?
  How to get only his filename in string, move the image file to public folder, and save it into XAMPP database?</p>