Package com.oreilly.servlet.multipart

Examples of com.oreilly.servlet.multipart.FileRenamePolicy.rename()


        if ( ! (existingVFSItem instanceof LocalImpl)) {
          throw new AssertException("Can only LocalImpl VFS items, don't know what to do with file of type::" + existingVFSItem.getClass().getCanonicalName());
        }
        File existingFile = ((LocalImpl)existingVFSItem).getBasefile();
        File tmpOrigFilename = new File(existingFile.getAbsolutePath());
        String renamedFilename = frp.rename(tmpOrigFilename).getName();
        newFile = (VFSLeaf) uploadVFSContainer.resolve(renamedFilename);
        // Copy content to tmp file
        BufferedInputStream in = new BufferedInputStream(fileEl.getUploadInputStream());
        BufferedOutputStream out = new BufferedOutputStream(newFile.getOutputStream(false));
        boolean success = false;
View Full Code Here


      File existsFile = new File(destinationDir, uploadFilename);
      if (existsFile.exists()) {
        // Use standard rename policy
        FileRenamePolicy frp = new DefaultFileRenamePolicy();
        File tmpF = new File(uploadFilename);
        uploadFilename = frp.rename(tmpF).getName();
      }
      // Move file now
      File targetFile = new File(destinationDir, uploadFilename);
      if (FileUtils.copyFileToFile(tempUploadFile, targetFile, true)) { return targetFile; }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.