diff --git a/FIT5032-Assignment/Controllers/System.cs b/FIT5032-Assignment/Controllers/System.cs index 5fc324b..b432e30 100644 --- a/FIT5032-Assignment/Controllers/System.cs +++ b/FIT5032-Assignment/Controllers/System.cs @@ -13,9 +13,18 @@ namespace FIT5032_Assignment.Controllers { if (!System.IO.File.Exists(filePath)) { return HttpNotFound(); } - var fileContent = System.IO.File.ReadAllText(filePath); - var contentType = MimeMapping.GetMimeMapping(fileName); - return File(fileContent, contentType); + // Read binary data from the file + byte[] fileBytes = System.IO.File.ReadAllBytes(filePath); + + // The binary file may png, jpg or jpeg + var fileExtension = Path.GetExtension(filePath).ToLowerInvariant(); + // Set the MIME type + if (fileExtension == ".png") { + return File(fileBytes, "image/png"); + } else if (fileExtension == ".jpg" || fileExtension == ".jpeg") { + return File(fileBytes, "image/jpeg"); + } + return HttpNotFound(); } } } \ No newline at end of file diff --git a/FIT5032-Assignment/Views/Appointments/Detail.cshtml b/FIT5032-Assignment/Views/Appointments/Detail.cshtml index b718131..65710a2 100644 --- a/FIT5032-Assignment/Views/Appointments/Detail.cshtml +++ b/FIT5032-Assignment/Views/Appointments/Detail.cshtml @@ -48,10 +48,26 @@