I am trying to capture a photo with a webcam and then save it on the localdb. After that i want to asign it to a user and each time a new photo is taken to rewrite the original photo on the server and all the references.
Capture photo code:
public ActionResult Capture()
{
var stream = Request.InputStream;
string dump;
using (var reader = new StreamReader(stream))
{
dump = reader.ReadToEnd();
DateTime nm = DateTime.Now;
string date = nm.ToString("yyyymmddMMss");
var path = Server.MapPath("~/WebImages/" + date + "test.jpg");
System.IO.File.WriteAllBytes(path, String_To_Bytes2(dump));
ViewData["path"] = date + "test.jpg";
Session["val"] = date + "test.jpg";
}
return View("Index");
}
The problem I am facing is that i am not sure how i can rewrite it each time and change all references in the db to it. Any help is welcomed! Thank you!