diff --git a/LearningHub.Nhs.WebUI/Controllers/ContributeController.cs b/LearningHub.Nhs.WebUI/Controllers/ContributeController.cs index fc3b7f76..d1feb59e 100644 --- a/LearningHub.Nhs.WebUI/Controllers/ContributeController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/ContributeController.cs @@ -197,8 +197,9 @@ public async Task UploadArticleFile(IFormCollection inputForm) var file = inputForm.Files[0]; int.TryParse(inputForm["resourceVersionId"], out int resourceVersionId); int.TryParse(inputForm["changeingFileId"], out int existingFileId); + int.TryParse(inputForm["fileSize"], out int fileSize); var currentUserId = this.User.Identity.GetCurrentUserId(); - return await this.contributeService.ProcessArticleFileAsync(resourceVersionId, file, existingFileId, currentUserId); + return await this.contributeService.ProcessArticleFileAsync(resourceVersionId, file, fileSize, existingFileId, currentUserId); } /// diff --git a/LearningHub.Nhs.WebUI/Interfaces/IContributeService.cs b/LearningHub.Nhs.WebUI/Interfaces/IContributeService.cs index 1f7f4154..2c982adf 100644 --- a/LearningHub.Nhs.WebUI/Interfaces/IContributeService.cs +++ b/LearningHub.Nhs.WebUI/Interfaces/IContributeService.cs @@ -87,10 +87,11 @@ public interface IContributeService /// /// Resource version id. /// File. + /// fileSize. /// Changing file id. /// Current user id. /// A representing the result of the asynchronous operation. - Task ProcessArticleFileAsync(int resourceVersionId, IFormFile file, int changeingFileId, int currentUserId); + Task ProcessArticleFileAsync(int resourceVersionId, IFormFile file, int fileSize,int changeingFileId, int currentUserId); /// /// The ProcessResourceAttachedFileAsync. diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue index 1d4cf7f6..1d153452 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue @@ -243,7 +243,7 @@ - + diff --git a/LearningHub.Nhs.WebUI/Services/ContributeService.cs b/LearningHub.Nhs.WebUI/Services/ContributeService.cs index 68a2b4cf..a78d3eb7 100644 --- a/LearningHub.Nhs.WebUI/Services/ContributeService.cs +++ b/LearningHub.Nhs.WebUI/Services/ContributeService.cs @@ -382,10 +382,11 @@ public async Task GetFileChunkDetail(int fileChunkDeta /// /// The resourceVersionId. /// The file. + /// The fileSize. /// The existingFileId. /// The currentUserId. /// The . - public async Task ProcessArticleFileAsync(int resourceVersionId, IFormFile file, int existingFileId, int currentUserId) + public async Task ProcessArticleFileAsync(int resourceVersionId, IFormFile file, int fileSize, int existingFileId, int currentUserId) { var filelocation = string.Empty; string extension = Path.GetExtension(file.FileName).Replace(".", string.Empty); @@ -415,7 +416,7 @@ public async Task ProcessArticleFileAsync(int resourceVersionI FileTypeId = fileType == null ? 0 : fileType.Id, FileName = file.FileName, FilePath = filelocation, - FileSize = (int)(file.Length / 1000), + FileSize = (int)(fileSize / 1000), ReplacedFileId = existingFileId, }); @@ -425,7 +426,7 @@ public async Task ProcessArticleFileAsync(int resourceVersionI ResourceVersionId = resourceVersionId, FileName = file.FileName, FileTypeId = fileType == null ? 0 : fileType.Id, - FileSizeKb = (int)(file.Length / 1000), + FileSizeKb = (int)(fileSize / 1000), Invalid = false, }; }