I'm using a jQuery webcam plugin to communicate with a webcam in my page and take a snapshot. The way it works is by communicating with a Flash helper. To save the picture it takes the name of another page and sends a web request to that page. And I'm successfully receiving that request on the other. I want to save the image from that request.
Asked
Active
Viewed 2,353 times
1
-
Which specific plugin? The solution would depend on how that plugin works. – millimoose Oct 07 '11 at 16:13
2 Answers
2
You claim to have the code for getting the request, you just need to load the image and save it to disk. This needs cleaned up, but something like the following should work:
System.IO.Stream respStream = resp.GetResponseStream();
System.Drawing.Image img = System.Drawing.Image.FromStream(respStream );
img.Save(PathToSaveTo):

Doozer Blake
- 7,677
- 2
- 29
- 40
-
Yes Let Me tell You Exactly The Scenario. I Have One Page That Have Jquery and Flash Object. In This Page I Defined My Other Page Where It Redirect When I Click On Save Image. And On Other Page Let Suppose Name "SavePic.asxp". I Want On This Page Load Pic Will Be Saved On My Defined Location. Can You Please Help Me In This Regard. Thanx – Arslan Pervaiz Oct 07 '11 at 17:57
-
3
1
I Have Done That In This And It Works For Me.
protected void Page_Load(object sender, EventArgs e)
{
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);
}
//Write jpg filename to be picked up by regex and displayed on flash html page.
Response.Write(strFile);
log.Close();
}

Arslan Pervaiz
- 1,575
- 4
- 29
- 62