namespace EnotaryoPH.Web.Common.Extensions { public static class IFormFileExtensions { public static string ToBase64StringUrl(this IFormFile file) { if (file == null || file.Length == 0) { throw new ArgumentNullException(nameof(file)); } using var memoryStream = new MemoryStream(); file.CopyTo(memoryStream); var fileBytes = memoryStream.ToArray(); return $"data:image/jpg;base64,{Convert.ToBase64String(fileBytes)}"; } } }