Skip to content

Instantly share code, notes, and snippets.

@shammelburg
Created November 26, 2015 16:08
Show Gist options
  • Save shammelburg/f5871e87378e903511e3 to your computer and use it in GitHub Desktop.
Save shammelburg/f5871e87378e903511e3 to your computer and use it in GitHub Desktop.
Convert Base64String to File
public void Convert(string Base64String)
{
string fileName = "test.jpg";
string rootpath = Server.MapPath(Path.Combine("~", "Image", fileName));
ConvertBase64ToFile.ConvertToFile(rootpath, Base64String.Split(',')[1]);
}
public class ConvertBase64ToFile
{
public static void ConvertToFile(string location, string file)
{
byte[] bytes = Convert.FromBase64String(file);
File.WriteAllBytes(location, bytes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment