I have a REST service that reads a file and sends it to another console application after converting it to Byte array and then to Base64 string. This part works, but when th
Probably the string would be like this data:image/jpeg;base64,/9j/4QN8RXh...
First split for / and get the second token.
var StrAfterSlash = Face.Split('/')[1];
Then Split for ; and get the first token which will be the format. In my case it's jpeg.
var ImageFormat =StrAfterSlash.Split(';')[0];
Then remove the line data:image/jpeg;base64, for the collected format
CleanFaceData=Face.Replace($"data:image/{ImageFormat };base64,",string.Empty);