title: MVC Capture webcam image, save file path of image to the database
body: <h1>Here is the gist of what I am trying to achieve:</h1>
  
  <ul>
  <li>Capture a webcam image from the Edit view. (working)</li>
  <li>Assign the image a file name and path. (working)</li>
  <li>Save the image to the images folder. (working)</li>
  <li>Store the path to the image in the database. (Not working)</li>
  </ul>
  
  <p>Here is my Capture controller:</p>
  
  <pre><code>      public void Capture(String FileLocation)
      {
          //var FileLocation = Server.MapPath("~/Images/test.jpg");
          var stream = Request.InputStream;
          string dump;
  
          using (var reader = new StreamReader(stream))
              dump = reader.ReadToEnd();
  
  
          if (System.IO.File.Exists(FileLocation))
          {
              System.IO.File.Delete(FileLocation);
              System.IO.File.WriteAllBytes(FileLocation, String_To_Bytes2(dump));
          }
          else System.IO.File.WriteAllBytes(FileLocation, String_To_Bytes2(dump));
  
  
          return;
  
      }
  </code></pre>
  
  <p>And here is the Edit controller:</p>
  
  <pre><code>    [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Edit(TrappingEvent trappingevent)
      {
  
          if (ModelState.IsValid)
          {
  
  
              db.Entry(trappingevent).State = EntityState.Modified;
              db.SaveChanges();
  
              return RedirectToAction("Index");
          }
  
          ViewBag.PersonId = new SelectList(db.People, "Id", "First_Name", trappingevent.PersonId);
          return View(trappingevent);
      }
  </code></pre>
  
  <p>From my limited understanding it would be nice to pass the file path as a variable from the Capture void to the controller for binding to the model.</p>
  
  <p>Thanks for your help.</p>