title: Laravel blade template <img src> not loading image after image upload upload (Failed to Load Resources Status 404)
body: <p>I am uploading image from my blade template and the image is stored in storage/app/public/images which I have linked to public/storage/images using php artisan storage:link so it can be accessed publicly everything seems to work very fine on localhost but not on live server.</p>
  
  <p>When I inspect the code I see this error message (GET <a href="http://domainname/storage/images/C1RWHeyLUokX8Hbz23bflhceAXzyEIHlqRDTl6UJ.jpeg" rel="nofollow noreferrer">http://domainname/storage/images/C1RWHeyLUokX8Hbz23bflhceAXzyEIHlqRDTl6UJ.jpeg</a> 404 (Not Found)).</p>
  
  <p>The image is uploaded and the path is stored correctly in my database, when I check the path I see the image in that path but is not loading on the web page.</p>
  
  <p>I have tried loading the image like this image) }}"> but still not working.</p>
  
  <p>//The blade template where I upload the image from</p>
  
  
        @csrf
  
           
  
             
      
  
  <p>//Route to where the image is uploaded
  Route::post('/update_user', 'DoctorsController@UpdateUser');</p>
  
  <p>//Controller to upload the image to server
      public function UpdateUser(Request $request){</p>
  
  <pre><code>    //capture the details sent by user for update
      $image = $request-&gt;file('image');
  
      //if the attachments is not empty upload the attachment to server
      if(!empty($image)){
  
         //$url = Storage::temporaryUrl(
          $allowed = array('jpg', 'jpeg', 'jpeeg', 'png', 'gif', 'bmp');
          $file_name = $_FILES['image']['name'];
          $files = explode('.', $file_name);
          $files1 = end($files);
          $file_extn = strtolower($files1);
          $filename1 = $files[0];
          $filename = strtolower($filename1);
          $file_temp = $_FILES['image']['tmp_name'];
  
            if(in_array($file_extn, $allowed) == true){
  
              $imageurl = $image-&gt;store('images', 'public');
  
  
               $data = array();
               $data['image'] = $imageurl;
  
              //store path to database
              $dt = DB::table('profiles')
                   -&gt;where('user_id', Auth::user()-&gt;id)
                   -&gt;update($data);
  
              return view('edit-user')-&gt;with(['message' =&gt; 'success']);
  
            }else {
  
              return view('edit-user')-&gt;with(['message' =&gt; 'invalidimage']);
  
            }
  
  
         }
  
  }
  </code></pre>
  
  <p>//When I try to display this image</p>
  
  <p>//Route to fetch the image from the database
  Route::get('/user_profile', 'DoctorsController@UserProfile');</p>
  
  <p>//Controller to retrieve this image
  public function UserProfile(Request $request){</p>
  
  <pre><code>        //fetch user details
          $profile=DB::table('profiles')
              -&gt;where('user_id', Auth::user()-&gt;id)
              -&gt;get();
  
          //return user profile when user is not doctor
          return view('user-profile')-&gt;with(['profile' =&gt; $profile]);
      }
  </code></pre>
  
  <p>//Blade template to display the image
  @foreach($profile as $profiles)</p>
  
  <p>image) ? asset('storage/'.$profiles->image) : asset('assets/img/image_placeholder.jpg')) }}" class="img-fluid mb-4" alt="Image placeholder" /></p>
  
  <p>@endforeach</p>
  
  <p>This code is expected to retrieve user image using the link stored on the database and display on a blade template, but but it doesn't display any image rather when I inspect the code I get this error message Failed to load resource: the server responded with a status of 404 (Not Found)</p>