I am encoding an image to a base64 string using powershell. The encoding is working ok as I have testing it using
<img src="data:image/JPEG;charset=utf-8;base64, <base64string>">
Now I am attempting to update an SQL Server 2012 table with the base64 string using the following update statement:
update images set ImageBlob = convert(varbinary(MAX),<base64string>)
I have also tried to cast it to varbinary
update images set ImageBlob = cast(<base64string>, as varbinary(max))
When the update script runs I check the field value and the value is completely different than what i expected. The image will also not render on my page at all.
Am i doing something wrong when I attempt to load it into my database?