i am trying to save image outside of my web app directory. i have hosted my application on shared. so i got a root folder to deploy my project. How can i just make a directory outside of my webapp so that i can upload my images on it. and if i redeploy my app then those images will not lost.
eg. i got root space and i pasted all my build folder on it. I want the upload folder not to be lost if I redeploy my app.
fileSystemPath= "/files";
try{
File destFile = new File(fileSystemPath, thempicFileName);
FileUtils.copyFile(thempic, destFile);
String path=fileSystemPath+"/"+thempicFileName;
With the above code a folder is creating in D drive(my current working directory), and in my db file is storing like /files/smg.png
And if i try to access that image using <img src="/files/smg.png"/>
from my jsp page then i am not geting that image to be display.
Where the project and files are exactly..
with the above code my images are saving in D:\myprojectDir\files
and my project location is D:\myprojectDir\projectfolder
THIS PROJECT IS BEING DEVELOP IN STRUTS2
Please suggest me in which way i have to write the code so that i can receive my images on jsp.