No One
No One

Reputation: 704

Spring boot files uploaded dynamically not showing

I'm making a Spring boot application, one of its functions is uploading images dynamically, after uploading the image the user is redirected to his profile page and the image shows there as the profile image. The problem I'm having is that the image, even if its uploaded and is inside the folder it should be, doesn't show when I log the image. I managed to show the image refreshing the project via eclipse (f5), but when I'm deploying the application in a JAR file it just doesn't show and I'm not sure what to do. It's like if Spring boot is not able to know that image is there...

Not sure how to fix this, any ideas?

Thanks alot!!

Upvotes: 1

Views: 710

Answers (2)

patrisrikanth12
patrisrikanth12

Reputation: 1

I faced the same problem. I changed the packaging from jar to war. It worked perfectly for me.

In pom.xml, inside project tag, I placed following line

<packaging>war</packaging>

Upvotes: 0

vikash kumar
vikash kumar

Reputation: 1

Please use the below code in the Helper file.

public final String UPLOAD_DIR = Paths.get("src/main/resources/static/image").toAbsolutePath().toString();

Upvotes: 0

Related Questions