private async Task <(string fileSrc, UploadErrorEnum?error)> UploadVideo(string chatId, MessageModel message) { var minSize = 50 * 1024 * 1024; var extension = Path.GetExtension(message.FileInline.FileName); if (!extension.IsValidVideoExtension()) { return(null, UploadErrorEnum.InvalidExtension); } if (long.Parse(message.FileInline.Size) > minSize) { return(null, UploadErrorEnum.OverSize); } var downloadPath = System.Web.Hosting.HostingEnvironment.MapPath(Utility.Variables.DownloadAddress); var relativeAddress = chatId + "\\" + Guid.NewGuid() + extension; var filePath = downloadPath + relativeAddress; var download = await MyWebClient.Download(message.FileInline.FileUrl, filePath); if (!download) { return(null, UploadErrorEnum.UploadIssue); } return(relativeAddress, null); }