简体   繁体   中英

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/

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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