1

I am getting problem in storing images fetched from some url.The problem is where to store image on server and what path is to be given on database.how to store images on server as a physical files and then later on retrieve that image on jsp page.

  • See struts 2 file upload interceptor – M Sach Nov 27 '14 at 07:18
  • possible duplicate of [Storing Images in java project dynamically](http://stackoverflow.com/questions/27163585/storing-images-in-java-project-dynamically) – Roman C Nov 27 '14 at 12:16

1 Answers1

0

You should make a folder in the project, use this folder to store physical files and give its path in action.

Online example is here to store image from database to specific folder.

Download Code here - Project URL

Your modification is not to store in db but store in your folder, for example if you have stored files in folder "images"

System.out.println(request.getRealPath("/")+"images\"+"YourFileName"+".jpg");

Above code will give you path of physical path on server.

Your Question is possible duplicate of

Struts2: How to store images outside of the webapp and save its path to the db?

Storing Images in java project dynamically

Community
  • 1
  • 1
prem30488
  • 2,828
  • 2
  • 25
  • 57