I have been reading about the best place to save images uploaded by users. In my case, I think it is better to store these images in the filesystem. I want to store them in the same server and keep it easy to mantain by other administrators.
Is it possible to set the upload folder inside the application context and configure Grails in order to not delete that folder when redeploying a new war?
If not, I wonder if the next code (gotten here by @yecid) would work as I think it uploads the images inside the 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 a valid path')
}
return root + File.separator