I'm trying to create an image in Sharepoint based on the Base64 encoded data which I have received in JSON format.
This Base64 comes in as:
data:image/png;base64,iVBORw0KGgoAAAANSUh...
If I use DecodeBase64ToBinary on this, I get the error
The template language function 'base64ToBinary' was invoked with a parameter that is not valid. The value cannot be decoded from base64 representation.'.
However, if I remove
data:image/png;base64,
from the start of the data, it works fine.
I thought this was needed as part of the Base64 data? It would be a pain if I have to remove it in order to decode it.
JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiA
Thanks @v-xiaochen-msft
I could have sworn I'd tried that already, but that fixed it!
HI @DuncanIVH ,
Please use datauritobinary instead of base64tobinlary if the string has a head like 'data:....'
Best Regards,
Wearsky
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional