java - client upload images store under web root directory -


this question has answer here:

in spring mvc inside entity class field name file.

@column private string photo; @transient private multipartfile file;  //whatever method setter/getter want store image in folder , file name in db public void setfile(multipartfile file) {      //file.getoriginalfilename()      //add timestamp filename      //using file.transferto(new file(....));      //finally setphoto(filename_with_timestamp) } 

here (in entity class) how servlet contextpath real path store images in working directory?

please 1 me

for security reasons not recommended let user upload in web root directory!

the better way store uploaded files in directory outside web root (outside web-server directory).


Comments

Popular posts from this blog

Linux vanilla kernel on QEMU and networking with eth0 -

rdbms - what exactly the undo information lives in oracle? -

clojure - 'get' replacement that throws exception on not found? -