I'm using MVC.NET
One of the fields in my MS SQL database is of type nvarbinary(MAX)
and this stores the image from a form.
Now I'd like to display this so am trying to read it out. The issue I'm having is how MVC is render it... At the moment, I'm trying this with JavaScript but am also happy to do it via C# on the HTML page
<script>
image.preview(@Html.Raw(Model.LandingPage.Image), "imagePreview")
</script>
The above is rendered into
<script>
image.preview(System.Byte[], "imagePreview")
</script>
I don't understand why it's rendering the type instead of the value...
When I save the image, I'm saving something which looks like
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAbCAYAAACJISRoAAAAG.....
(for clarity, I split it by the ,
and as such only save iVBORw0KGgoAAAANSUhEUgAAABkAAAAbCAYAAACJISRoAAAAG.....
I'd like to read this value back out but as I've shown in the above, I don't know how. The idea is to show this value in the following tag
<img id="myPreviewImage" />
If JavaScript isn't possible then I can use C# on the HTML page