title: Check if file exists with Laravel 5.5 Storage? Storage for Avatar
body: <p>Based on this code: <a href="https://devdojo.com/episode/laravel-user-image" rel="nofollow noreferrer">https://devdojo.com/episode/laravel-user-image</a> I created the following code in order to upload an avatar and delete the old one. I'm tried to use Storage:Facade but I'm not sure if it is the right way. So let's look at my code excerpt:</p>
  
  <pre><code>                    use Illuminate\Support\Facades\Storage;
                      ..
  
                      $avatar = $request-&gt;file('avatar');
  
                      $filename = time() . '.' . $avatar-&gt;getClientOriginalExtension();      
  
                      //Using Image intervention, storing to Public/Images/user
                      Image::make($avatar)-&gt;orientate()-&gt;fit(220)-&gt;save( public_path('/images/user/' . $filename ) );
                      $user = Auth::user();
  
                      $oldavatar = $user-&gt;avatar;
  
                      $user-&gt;avatar = $filename;
                      $user-&gt;save();
  
                      //Delete old avatar
                      if($oldavatar != 'profile.jpg' and Storage::disk('public')-&gt;exists('/images/user/' . $oldavatar );){
  
                          Storage::disk('public')-&gt;delete('/images/user/' . $oldavatar );
                      }
  </code></pre>
  
  <p>So I tested it out with dd(Storage::disk('public')->exists('index.php')); etc. I tried every file there is. I also added a disk in the filesystem.php with</p>
  
  <pre><code>    'images' =&gt; [
          'driver' =&gt; 'local',
          'root' =&gt; storage_path('app/public/images'),
          'visibility' =&gt; 'public',
      ],
  </code></pre>
  
  <p>Still nothing, I'm getting a false for exists. </p>