How to configure Grails to avoid deletion of uploaded images when redeploy in a Tomcat server -


i have been reading best place save images uploaded users. in case, think better store these images in filesystem. want store them in same server , keep easy mantain other administrators.

is possible set upload folder inside application context , configure grails in order not delete folder when redeploying new war?

if not, wonder if next code (gotten here @yecid) work think uploads images inside application context:

//for development environment def root = system.properties['base.dir']?.tostring() if(!root){     //for production environment in war deplements     def tmproot = applicationholder.application.maincontext.getresource('web-inf').getfile().tostring()     root = tmproot.substring(0, tmproot.indexof(file.separator + 'temp' + file.separator)) } if(!root){     throw new exception('not found valid path') } return root + file.separator 

in code, see saving uploaded files web-inf folder. although can that, when restart server/ redeploy application, content of web-app folder replaced, hence uploaded file removed well. that's how tomcat works.

i think better way saving uploaded file folder not inside of web container (tomcat) folder. way, won't deleted when you:

1) redeploy web application

2) restart tomcat whatever reason

a practice team used create custom folder in home folder of current user. way don't have worry privilege save files.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -