This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
May I ask where the user save their photos & data ?
If this happens to be a Database, then nothing would be required.
For I/O operations over the disk, where are you saving ? Also, can you provide the code?
Edit: as tim mentioned, it is helpful to keep the files outside webapps (or tomcat in general) folder itself.
Joined: Jun 28, 2010
unfortunately, my folder inside the war .I display that uploaded photo and if i create the folder outside tomcat it will be problem for me .
Anyway thanks for your support and fast reply .
Folder creation outside "webapps" folder is enough to solve that issue , right ?
I do not recommend creating your own files and directories in the Tomcat folder. It's possible that you might someday find them conflicting with a newer version of Tomcat. It's even more likely that someone might update Tomcat and you'd lose your folders with no warning whatsoever.
WARs should be considered as Read-Only. Although some webapp servers have the ability to explode the WAR file into a directory tree and modify what's in that directory tree, it is not a right conferred by the J2EE spec, and you violate it at your peril.
You should be using an external data directory. In Linux, a common place to put directories like that is under /var/lib. In Windows, the system documents folder makes a good starting point. For best results, you should not hard-code the document directory path into your WAR - use a web.xml resource definition to define it, JNDI to retrieve it, and a Tomcat Context to set the path that applies to the machine that the webapp is deployed to.