public override string MoveFile(string path, string newPath) { try { string virtualPathAndFile = FileSystemValidation.ToVirtualPath(path); string virtualNewPathAndFile = FileSystemValidation.ToVirtualPath(newPath); string virtualPath = FileSystemValidation.RemoveFileName(virtualPathAndFile); string virtualNewPath = FileSystemValidation.RemoveFileName(virtualNewPathAndFile); string returnValue; if (virtualPath == virtualNewPath) { //rename file returnValue = DNNValidator.OnRenameFile(virtualPathAndFile); if (!(string.IsNullOrEmpty(returnValue))) { return(returnValue); } } else { //move file returnValue = DNNValidator.OnMoveFile(virtualPathAndFile, virtualNewPathAndFile); if (!(string.IsNullOrEmpty(returnValue))) { return(returnValue); } } //Returns errors or empty string when successful (ie: NewFileAlreadyExists) //returnValue = TelerikContent.MoveFile(virtualPathAndFile, virtualNewPathAndFile); var folderPath = FileSystemValidation.ToDBPath(path); var folder = FolderManager.Instance.GetFolder(PortalSettings.PortalId, folderPath); if (folder != null) { var file = FileManager.Instance.GetFile(folder, GetFileName(virtualPathAndFile)); if (file != null) { var destFolderPath = FileSystemValidation.ToDBPath(newPath); var destFolder = FolderManager.Instance.GetFolder(PortalSettings.PortalId, destFolderPath); var destFileName = GetFileName(virtualNewPathAndFile); if (destFolder != null) { if (file.FolderId != destFolder.FolderID && FileManager.Instance.GetFile(destFolder, file.FileName) != null) { returnValue = "FileExists"; } else { FileManager.Instance.MoveFile(file, destFolder); FileManager.Instance.RenameFile(file, destFileName); } } } else { returnValue = "FileNotFound"; } } if (!(string.IsNullOrEmpty(returnValue))) { return(GetTelerikMessage(returnValue)); } return(returnValue); } catch (Exception ex) { return(DNNValidator.LogUnknownError(ex, path, newPath)); } }