Hi Jasonix-8458,
To display images (store as bytes array or base64 string) in the razor page, you could try to the following sample code: the ContentFile data type is byte[]
, we should transfer it to base64 string, then use an <img>
tag to display the image:
<div class="form-group col-4">
<label asp-for="ContentForoModel.ContentFile" class="control-label h2"></label>
@{
var base64 = Convert.ToBase64String(Model.ContentForoModel.ContentFile);
var Image = String.Format("data:image/svg+xml;base64,{0}", base64);
}
<img src="@Image" alt="" class="img-fluid">
</div>
The result like this:
More detail code, you could refer the reply in this thread: How to display an image saved on database in .NET Core API?
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Dillion