Spring Boot Image Upload with Thymeleaf (No Database)

Поделиться
HTML-код
  • Опубликовано: 26 янв 2025

Комментарии • 4

  • @rkroy39
    @rkroy39 15 дней назад

    Very nice

  • @rkroy39
    @rkroy39 15 дней назад +1

    What was the reason of non display of image at first?

    • @WebdoxComputerInstituteJal
      @WebdoxComputerInstituteJal  15 дней назад

      @@rkroy39
      Basically “uploads” folder ki ander ki files (static files) ka link usne access nahi kiya directly wo karne ke liye hamne WebConfig class banai aur use implement kiya *WebMvcConfigurer* interface se.
      *WebMvcConfigurer* interface se ham Spring MVC ki configuration change kar sakte hai
      Esme hamne *addResourceHandlers* menthod override kiya hai . Es method se ham static resources ki handling ko configure karte hai.
      Static resources image, css ya js ho sakti hai.
      Es method ke ander hamne url pattern /uploads/** ko map kiya hai drive ki physical location ke sath for “file:/uploads/“
      Simple me samjhe to es se apko http based links mil jayenge jo apke upload folder ki files ko access kar sakenge.
      Wahi link jab ham image tag me dalenge to image show hogi.