Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to save and upload images through webcam in web application.Please help.I hv tried this code,working on local machine but after hosting,its not saving the image at server:

System.Drawing.Image originalimg;
string strFile = DateTime.Now.ToString("dd_MMM_yymmss") + ".jpg";

FileStream log = new FileStream(Server.MapPath(strFile), FileMode.OpenOrCreate);

byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputStream.Read(buffer, 0, buffer.Length)) > 0)
{
log.Write(buffer, 0, c);
}
originalimg = System.Drawing.Image.FromStream(log);
originalimg = originalimg.GetThumbnailImage(320, 240, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
originalimg.Save(Server.MapPath("Images") + "\\" + strFile);
//originalimg.Save( "D:\\WebcamImages\\" + strFile);
//Write jpg filename to be picked up by regex and displayed on flash html page.
log.Close();
originalimg.Dispose();
File.Delete(Server.MapPath(strFile));
Response.Write("../Images/" + strFile);
Session["ImgUrl"] = "../Images/" + strFile;
Response.Redirect("PhotoCapture.aspx");
Posted
Updated 22-Aug-13 6:51am
v2
Comments
joshrduncan2012 22-Aug-13 12:09pm    
Help you with what? You haven't shown us any effort on your part first. What have you tried so far?
Jameel VM 22-Aug-13 12:54pm    
what's the pblm?

1 solution

I have also this problem,this code work fine for localhost but when I publish application it not working...I try lots and find other code for Image capture, they use Jquery and javascript for webcam access...It work fine with my application.
download file from http://dosya.co/1e5aaas1pzu3/WebCamApplication.rar.html
and integrate with your application
best luck
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900