Hello i have images folder like this

What i want to do, is upload images to that folder and display them like this localhost:8080/image.jpg , so i can display it in frontend.. Nothing wrong is with upload, but i have no idea with displaying this images with api.
I already have tried
@Configuration
public class AdditionalResourceWebConfiguration implements WebMvcConfigurer {
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
registry.addResourceHandler("/images/**").addResourceLocations("file:images/");
}
}
But this is not working..
What i want to do, is upload images to that folder and display them like this localhost:8080/image.jpg
URL should be localhost:8080/images/image.jpg as you are saving the images in images folder and mapping them as /images in addResourceHandler method
@Configuration
public class AdditionalResourceWebConfiguration implements WebMvcConfigurer {
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
registry.addResourceHandler("/images/**")
.addResourceLocations("file:images\\");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With