java - Uploaded files missing -


i uploading file in server location everytime..but after sometime or next day location missing system.so getting error file not found exception always..

here code

        string filename = file.getfilename().trim();            if(!("").equals(filename)){                  long timestamp = com.mysql.jdbc.util.getcurrenttimenanosormillis();                 string fileextension = filename.substring(filename.lastindexof("."));                                filename = filename.substring(0,filename.lastindexof("."));                              string newfilename = filename.concat("-").concat(string.valueof(timestamp)).concat(fileextension);                 string foldercreated = folder + "\\" + newfilename;                 dto.setreplydocname(newfilename);                 fos = new fileoutputstream(foldercreated);                 fos.write(file.getfiledata());                 dto.setreplydoclocation(foldercreated);                 fos.flush();                 fos.close();          } 

you're storing uploaded files in temp directory eclipse uses deploy webapp. each time deploy webapp, directory cleared.

uploaded files shouldn't stored there. configure absolute path files should stored (like c:\uploaded_files), , store files in directory.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -