java - Uploaded files gets deleted automatically? -


I wrote a servlet to upload a file using a form. Before I used a full path: string path = "c: \\ folder \\ subfolder \\"; And I used this upload to upload this file and it worked fine. I've changed the path to upload: string path = request.getServletContext (). GetRealPath ("") + "\\ Folder \\ subfolder \\" and now I think the files will be automatically deleted shortly after.

My question is, is it considered a temporary file and is removed after some time or is it for some other reason? Here is my code:

  uploadFile file = new upload file (); // Upload file! Boolean Checker = Wrong; String uploadpath = request.getServletContext (). GetRealPath ("") + "\\ upload \\ riparazione \\"; Investigator = file.domainport (IDRiparion, request, feedback, sourcefile, uploadpath);   

doImport is the following function:

  public boolean doImport string uploadpath) {Disfile ITEM Factory Factory = New Disk File Iatamfactureri (); Factory.setSizeThreshold (THRESHOLD_SIZE); Factory.setRepository (new file (System.getProperty ("java.io.tmpdir"))); Servicelet file upload upload = new servile file upload (factory); Upload.setFileSizeMax (MAX_FILE_SIZE); Upload.setSizeMax (MAX_REQUEST_SIZE); // directory creates if this file is not uploaded; New file (uploadpath); If (! Uploaddir.exists ()) uploaddir.mkdirs (); String filename = new file (item.getName ()). GetName (); FileName = name + "-" + fileName; String filePath = uploadPath + File.Sseparator + fileName; Try {// disc file saves file on file file = new file (filePath); If (! StoreFile.exists ()) item.write (storeFile); Second false return; } Hold (exception e) {e.printStackTrace (); } Back true; }  

I am using xampp for apache tomcat 7.0, eclipse and OS windows 7.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -