保存图像从WebRequest类在C# [英] Save Image From Webrequest in C#
本文介绍了保存图像从WebRequest类在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用一个jQuery插件,摄像头在我的网页摄像头进行沟通,并采取快照。它的工作方式是通过一个Flash帮手通信。以保存它需要另一个页面的名称,并发送一个网页请求到该网页的图像。而且我成功接收另一该请求。我想将图像从该请求保存。
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.
推荐答案
我已经做了,在这一点,它为我工作。
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();
}
这篇关于保存图像从WebRequest类在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文