简体   繁体   English

如何从Flash捕获一个HTTP发布文件到ASP.Net页面?

[英]how to catch an http post file from Flash to ASP.Net page?

I'm working on a sample i found on this site: 我正在研究在此网站上找到的样本:

http://kevinmusselman.com/blog/2009/02/access-webcam-with-flash/ http://kevinmusselman.com/blog/2009/02/access-webcam-with-flash/

it captures the webcam & saves the image then posts it to a page. 它会捕获网络摄像头并保存图像,然后将其发布到页面上。

but it seems that i couldn't catch the saved image, im kinda rusty on AS so I hope someone here could help me. 但似乎我无法捕捉到保存的图像,在AS上有点生锈,所以我希望这里有人可以帮助我。

i'm capturing the response in a aspx page and save the image in a file. 我在aspx页面中捕获响应并将图像保存在文件中。 here's my asp.net code: 这是我的asp.net代码:

if (Request.Files.Count == 0)
            {
                Response.Write("ERROR: No files were uploaded");
                return;
            }

            string pt = Path.Combine(PathFolder, "test.jpg");

            if (Directory.Exists(PathFolder))
            {
                //go through all of the files and save them off
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    Request.Files[i].SaveAs(pt);
                }
                Response.Write("SUCCESS");
            }

That article doesn't post the image as an image, rather it sends it as a series of fields called px0..px ROWS . 该文章没有将图像发布为图像,而是将其作为一系列称为px0..px ROWS的字段发送。 These contain the Comma separated pixel values for each pixel on that row. 这些包含该行上每个像素的逗号分隔像素值。

The PHP then reconstructs this into a image by individually going through each row, then each column, and setting the pixel in an in memory image. 然后,PHP通过分别遍历每一行,然后每一列,并在内存图像中设置像素,将其重建为图像。 Then writes that to disk. 然后将其写入磁盘。

So, either you recreate the PHP, or you try to find a different example . 因此,您要么重新创建PHP,要么尝试查找其他示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM