Dinkar Veer

Dinkar Veer

  • NA
  • 81
  • 1.3k

capture image through webcam and store in database

Mar 20 2017 5:30 AM
<script type="text/javascript"> 
function savePhoto() { 
var data = embed.toDataURL(); 
var title = $("#title").val();              
$.ajax({                 
type: "POST",                 
url: "Security_GatePass.aspx",                 
data: 'data1=data', }).done(function (o) {                 
alert("Photo Saved Successfully!");
 }); } 
</script>
<div> <object width="405" height="190"> 
<param name="movie" value="WebcamResources/save_picture.swf"/> 
<embed src="WebcamResources/save_picture.swf" width="405" height="190"/>
 </object>
 </div>

i can capture image by this but i can't save the captured image in database..

i tried like this codebihind..


 String source = Request.Form["photo"]; 
 source =source.Substring(source.IndexOf(",") + 1);
 byte[] photo =Convert.FromBase64String(source);     
photoParam.Value = photo;

Line 55: String source = Request.Form["photo"]; Line 56: // remove extra chars at the beginning Line 57: source = source.Substring(source.IndexOf(",") + 1); Line 58: byte[] photo = Convert.FromBase64String(source); Line 59: photoParam.Value = photo;

Object reference not set to an instance of an object. to Line 57.

But its not working..

plz help me


thank you in advance



Answers (2)