這裏是我的AS3代碼:從FLASH中獲取POST數據到ASP.Net
var jpgEncoder:JPGEncoder = new JPGEncoder(100);
var jpgStream:ByteArray = jpgEncoder.encode(bitmapData);
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest("/patients/webcam.aspx");
jpgURLRequest.requestHeaders.push(header);
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;
navigateToURL(jpgURLRequest, "_self");
這是我的ASP.Net代碼
try
{
string pt = Path.Combine(PathFolder, "test.jpg");
HttpFileCollection fileCol = Request.Files;
Response.Write(fileCol.Count.ToString());
foreach (HttpPostedFile hpf in fileCol)
{
hpf.SaveAs(pt);
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
我發現了一個奇怪的錯誤,是HttpFox提到:「 NS_ERROR_NET_RESET「
可能重複的[如何從Flash到ASP.Net頁面捕獲http post文件?](http://stackoverflow.com/questions/1634974/how-to-catch-an-http-post-file- from-flash-to-asp-net-page) – 2014-03-30 13:15:58