/// <summary> /// Move the file /// </summary> /// <param name="sourcePath">Path to the source file</param> /// <param name="destinationPath">Path to the destination file</param> /// <returns>A task that represents the completion of the operation</returns> protected virtual async Task MoveFileAsync(string sourcePath, string destinationPath) { string fullSourcePath = GetFullPath(GetVirtualPath(sourcePath)); if (!_fileProvider.FileExists(fullSourcePath)) { throw new Exception(GetLanguageResource("E_MoveFileInvalisPath")); } destinationPath = GetFullPath(GetVirtualPath(destinationPath)); if (_fileProvider.FileExists(destinationPath)) { throw new Exception(GetLanguageResource("E_MoveFileAlreadyExists")); } if (!CanHandleFile(_fileProvider.GetFileName(destinationPath))) { throw new Exception(GetLanguageResource("E_FileExtensionForbidden")); } try { _fileProvider.FileMove(fullSourcePath, destinationPath); await HttpContext.Response.WriteAsync(GetSuccessResponse()); } catch { throw new Exception($"{GetLanguageResource("E_MoveFile")} \"{sourcePath}\""); } }