diff --git a/EnotaryoPH/EnotaryoPH.Web/Common/Extensions/IFormFileExtensions.cs b/EnotaryoPH/EnotaryoPH.Web/Common/Extensions/IFormFileExtensions.cs index 164d237..20d83ac 100644 --- a/EnotaryoPH/EnotaryoPH.Web/Common/Extensions/IFormFileExtensions.cs +++ b/EnotaryoPH/EnotaryoPH.Web/Common/Extensions/IFormFileExtensions.cs @@ -2,7 +2,9 @@ { public static class IFormFileExtensions { - public static string ToBase64StringUrl(this IFormFile file) + public static string ToBase64StringUrl(this IFormFile file) => $"data:image/jpg;base64,{file.ToBase64String()}"; + + public static string ToBase64String(this IFormFile file) { if (file == null || file.Length == 0) { @@ -12,7 +14,7 @@ using var memoryStream = new MemoryStream(); file.CopyTo(memoryStream); var fileBytes = memoryStream.ToArray(); - return $"data:image/jpg;base64,{Convert.ToBase64String(fileBytes)}"; + return Convert.ToBase64String(fileBytes); } } } \ No newline at end of file