here's my AS3 code:
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");
And here's my ASP.Net Code
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);
开发者_JS百科 }
I'm getting a weird error, HttpFox mentioned: "NS_ERROR_NET_RESET"
You should replace the contentType to multipart/form-data if you want to use c# Request.Files property.
See http://msdn.microsoft.com/en-us/library/system.web.httprequest.files.aspx
Also it requires some changes in flash code, as the data should be encoded in MIME multipart format.
精彩评论