}
} else {
// file already exists... upload anyway with new filename and
// in the folder manager status.
// rename file and ask user what to do
FileRenamePolicy frp = new DefaultFileRenamePolicy();
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;