Created
November 26, 2015 16:08
-
-
Save shammelburg/f5871e87378e903511e3 to your computer and use it in GitHub Desktop.
Convert Base64String to File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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