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

余生颓废 提交于 2020-01-06 07:07:44

问题


I'm working on a sample i found on this site:

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.

i'm capturing the response in a aspx page and save the image in a file. here's my asp.net code:

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");
            }

回答1:


That article doesn't post the image as an image, rather it sends it as a series of fields called px0..pxROWS. 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. Then writes that to disk.

So, either you recreate the PHP, or you try to find a different example.



来源:https://stackoverflow.com/questions/1634974/how-to-catch-an-http-post-file-from-flash-to-asp-net-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!