I have a base64 jpeg like so: data:image/jpeg;base64 and I am trying to convert it to a MemoryStream so I can upload it to OneDrive....Here is what I got so far:
byte[] frontBytes = Convert.FromBase64String(user.FrontLicense);
using (MemoryStream frontMS = new MemoryStream(frontBytes))
{
await graphClient.Me.Drive.Items[newFolder.Id].ItemWithPath("FrontLicense.jpeg").Content.Request().PutAsync<DriveItem>(frontMS);
}
But I get this error:
The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
On this line:
byte[] frontBytes = Convert.FromBase64String(user.FrontLicense);
This is what user.FrontLicense looks like:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoM.....
What am I doing wrong?