Reputation: 1
Hello guys im trying to save a picture taken from my webcam. im actually using this code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
public partial class ImageConversions : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
CreatePhoto();
}
void CreatePhoto()
{
try
{
string strPhoto = Request.Form["imageData"]; //Get the image from flash file
byte[] photo = Convert.FromBase64String(strPhoto);
FileStream fs = new FileStream("C:\\Webcam.jpg", FileMode.OpenOrCreate, FileAccess.Write);
BinaryWriter br = new BinaryWriter(fs);
br.Write(photo);
br.Flush();
br.Close();
fs.Close();
}
catch (Exception Ex)
{
}
}
}
The application RUNS, i get to see the image , i click the capture button it gives no error till here BUT BUT BUT ... NO IMAGE IS SAVED EITHER i downloaded the sample from HERE : http://www.dotnetspider.com/resources/38150-Capture-save-images-from-Web-camera.aspx (check the attachemnt)
Upvotes: 0
Views: 9049
Reputation: 1674
Try this article. It works pretty good. But I couldn't work with a custom message when webcam is not attached. It gives a auto generated error message.
Upvotes: 0
Reputation: 1
Change Path.. I also had same problem.. Your C Drive Has security level high, Change path to "D:\Webcam.jpg" and it will work
Upvotes: 0