Skip to content

Commit

Permalink
Client recieves error message when uploading a file that exceeds the …
Browse files Browse the repository at this point in the history
…size limit and when there is no file chosen
  • Loading branch information
jessietech08 committed Dec 11, 2024
1 parent caafdda commit 0802113
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions PC2/Controllers/AboutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ public async Task<IActionResult> UploadNewsletter(IFormFile userFile)
// add newsletterFile to the DB
await NewsletterFileDB.AddAsync(_context, newsLetterFile);
}
else
{
TempData["Message"] = $"Choose file without exceeding 128 MB";
return RedirectToAction("UploadNewsletter");
}

return RedirectToAction("UploadNewsletter");
}
Expand Down
1 change: 1 addition & 0 deletions PC2/PC2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<Folder Include="wwwroot\images\resource\" />
<Folder Include="wwwroot\PDF\DisabilityAwareness\" />
<Folder Include="wwwroot\PDF\focus-newsletters\" />
<Folder Include="wwwroot\PDF\focus-newsletters\" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions PC2/Views/About/UploadNewsletter.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

if(hasTempData)
{
<div class="alert alert-success alert-dismissible fade show" role="alert">
@TempData["Message"]
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-success alert-dismissible fade show" role="alert">
@TempData["Message"]
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
}
}
<hr />
Expand Down

0 comments on commit 0802113

Please sign in to comment.