Please bear with me, my English is still improving... Below given code is what I am using to get an uploaded image saved in "UploadedImage" folder in ASP.NET MVC 5 project. But when I use my almost high-end PC having i7 processor, 16GB of RAM, 4GB Graphics Card, all works like a charm. But problem arises when I use my laptop having i3 processor and 8GB of ram or a PC having i3 processor having 4GB RAM.... What I get is only a black image.
public ActionResult Index(FormCollection form)
{ if (string.IsNullOrEmpty(form["image-data"])) return
View();
var t = form["image-data"].Substring(form["image-data"].LastIndexOf(',') + 1);
byte[] bytes = Convert.FromBase64String(t);
string fileName = form["email"].Replace("@", "at");
fileName = fileName.Replace(fileName[fileName.LastIndexOf(".")].ToString(), "dot");
var fullPath = Path.Combine(Server.MapPath("~/UploadedImage/"), fileName + ".png");
Image image;
using (var streamBitmap = new MemoryStream(bytes))
{
using (image = Image.FromStream(streamBitmap))
{
image.Save(fullPath);
}
}
Please help me, I could not get any help from anywhere, thanks in advance