Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash PNG偶尔会在从闪存到服务器的过程中丢失数据_Flash_Png - Fatal编程技术网

Flash PNG偶尔会在从闪存到服务器的过程中丢失数据

Flash PNG偶尔会在从闪存到服务器的过程中丢失数据,flash,png,Flash,Png,我们在这个问题上遇到了困难,希望得到一些帮助 我们的用户正在Flash中创建TIF,并通过HTTP POST将Base64中的图像数据发布到接收该图像数据的ASPX服务器,该服务器使用: byte[] bytes = Convert.FromBase64String(Request.Form["ImgData"] ); 我们发现该方法是有效的,但在20-30种左右的情况下,服务器接收到的数据量与客户端声称发送的数据量不同。ASPX代码: dataLengthSentFromClient =

我们在这个问题上遇到了困难,希望得到一些帮助

我们的用户正在Flash中创建TIF,并通过HTTP POST将Base64中的图像数据发布到接收该图像数据的ASPX服务器,该服务器使用:

byte[] bytes = Convert.FromBase64String(Request.Form["ImgData"]  );
我们发现该方法是有效的,但在20-30种左右的情况下,服务器接收到的数据量与客户端声称发送的数据量不同。ASPX代码:

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

我能想象的唯一原因(假设您使用的每个库都正常工作)是base64符号是urlencoded而不是urldecoded。Base64有'+',在后期传输过程中会进行URL编码,我不确定这个ASPX库是否自己进行URL解码。在这种情况下,即使对于几个字节的随机数据,错误概率也高于1/25。但可能您使用的是小尺寸的非随机测试数据

可以发送相同的PNG,第一次发送失败,但第二次发送失败。这让我觉得这与Base64编码无关,不是吗?这很好,可以节省流量,但我不确定这是否会导致偶尔的传输失败。我们使用的软件包:com.adobe.images.PNGEncoder;和com.hurlant.util.Base64;缓存问题很有趣。我会调查的。您是否建议采用更可靠的方式从Flash传输图像数据?如果有帮助的话,我很乐意改变它!
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;