0

私たちはこれに困惑しており、助けが欲しいです!

私たちのユーザーは、Flash で TIF を作成し、Base64 の画像データを HTTP POST 経由で ASPX サーバーに投稿しています。

byte[] bytes = Convert.FromBase64String(Request.Form["ImgData"]  );

この方法は機能することがわかりましたが、20 ~ 30 ほどのケースのいずれかで、サーバーによって受信されたデータの量が、クライアントが送信していると主張するものとは異なります。ASPX コード:

dataLengthSentFromClient = Request.Form["dataLengthFromClient"].ToString();
<>
ReceivedBytesLength=Request.Form["ImgData"].Length.ToString();

しかし、他の24回はうまく機能しているようです。何か案は?この方法で Flash からサーバーにデータを渡すべきではありませんか?


(これがクライアント AS コードです) var image:BitmapData;

if (toTrim) {
tempBitmapData=new BitmapData(workingSrc.width,workingSrc.height,true,0x00000000);
tempBitmapData.draw(workingSrc);
var tempBitmap:Bitmap=new Bitmap(tempBitmapData,PixelSnapping.ALWAYS,true);
bounds=tempBitmapData.getColorBoundsRect(0xFF000000,0x00000000,false);
var letterMatrix:Matrix=new Matrix(1,0,0,1,- bounds.x,- bounds.y);
tempBitmap.transform.matrix=letterMatrix;
image=new BitmapData(bounds.width,bounds.height,true,0x00000000);
image.draw(tempBitmap,letterMatrix);
} else {
image=new BitmapData(workingSrc.width,workingSrc.height,true,0x00000000);
image.draw(workingSrc,letterMatrix);
}


var bytes:ByteArray=PNGEncoder.encode(image);
var base64Bytes:String=Base64.encodeByteArray(bytes);

var vars:URLVariables = new URLVariables();
vars.activityID=activityID;
vars.imgData=base64Bytes;
vars.dataLengthFromSarah=vars.imgData.length;
vars.activityLocation=activityLoc;
vars.op="writePNG";
if (fileName!=null) {
vars.filename=fileName;
}
// Save info about the variables passed in case we need to dump error data
dispatchEvent(new DumpPrepEvent(vars.toString()));

var url:URLRequest=new URLRequest(INTERFACE);
url.data=vars;
url.method=URLRequestMethod.POST;
4

1 に答える 1

0

私が想像できる唯一の理由 (使用するすべてのライブラリが正しく機能すると仮定) は、base64 シンボルが urlencoded であるが urldecode ではないことです。Base64 には「+」があり、ポスト転送中に urlencode されますが、この ASPX ライブラリが独自に urldecode を行うかどうかはわかりません。この場合のエラーの確率は、数バイトのランダム データでも 1/25 より高くなります。ただし、サイズの小さい非ランダム テスト データを使用している可能性があります。

于 2012-07-10T11:16:01.347 に答える