Skip to content

Instantly share code, notes, and snippets.

@JustinK
Created October 30, 2014 20:56
Show Gist options
  • Save JustinK/352b0e356fa767285871 to your computer and use it in GitHub Desktop.
Save JustinK/352b0e356fa767285871 to your computer and use it in GitHub Desktop.
var imageFile = hiddenFile.Value;
String img = imageFile.Replace("data:image/jpeg;base64,", "").Replace(" ", "+");
byte[] b = Convert.FromBase64String(img);
var timestamp = DateTime.Now.ToString("yyyy_MM_dd_HHmmssfff");
var virtualDirectoryPath = "~/Receipts/" + year + "/";
var fileName = Path.Combine(page.Server.MapPath(virtualDirectoryPath),
timestamp + ".jpg");
System.IO.File.WriteAllBytes(fileName, bytes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment