Copy link to clipboard
Copied
We use Flash to generate dynamic graphics and convert them to a PNG graphic by posting the base64 encoded bitmpa data to a coldfusion page, which saves the graphics file on the server.
This works well most of the time but for certain larger graphics we a ColdFusion exception in the post page, as follows:
08/02 12:40:16 error ROOT CAUSE:
java.lang.IllegalArgumentException: err.io.short_read
at coldfusion.filter.FormScope.parsePostData(FormScope.java:325)
at coldfusion.filter.FormScope.fillForm(FormScope.java:295)
at coldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:377)
etc....
I have not been able to find out whether this is a problem with the Flash code that does the posting or with some other configuration issue. The maxumum post size is 200MB and the images data is less than 200K
The Flash code for posting:
var img_source:BitmapData = new BitmapData (this.width, this.height+5);
img_source.draw(this);
//encode the bitmapdata object and keep the encoded ByteArray
var img_byte_array:ByteArray = PNGEncoder.encode(img_source);
var imgURLRequest:URLRequest = new URLRequest(image_url);
var requestVars:URLVariables = new URLVariables();
requestVars.upload_image_name = image_name;
// Convert to Base 64
requestVars.upload_image_data = Base64.encodeByteArray(img_byte_array);
imgURLRequest.data = requestVars;
imgURLRequest.method = URLRequestMethod.POST;
navigateToURL(imgURLRequest, "_self");
The ColdFusion page:
<cfsetting showdebugoutput="no">
<cfparam name="upload_image_name" default="">
<cfparam name="upload_image_data" default="">
<!--- Image was posted to the server, save it --->
<html>
<head>
</head>
<body>
<cfoutput>Actual Size of image: #Len(upload_image_data)#</cfoutput><p>
<!--- Save the image file --->
<cffile action="write"
file= "#Application.properties.flash_test_result_tmp_directory##upload_image_name#"
output="#ToBinary(upload_image_data)#"/>
<button type="button" onClick="this.close();">Close this window</button>
</body>
</html>
It looks like the host name was the issue. We used http://localhost:8302 and changing that to use the local IP address instead, such as http://<IP address>:8302 solved the problem. Not sure exactly why. The Flash movie contained an image that was loaded into the Flash movie from the server as well. But presumably when the bytes were collected from the finished movie's bitmap, the origins of the images are irrelevant?
Copy link to clipboard
Copied
It looks like the host name was the issue. We used http://localhost:8302 and changing that to use the local IP address instead, such as http://<IP address>:8302 solved the problem. Not sure exactly why. The Flash movie contained an image that was loaded into the Flash movie from the server as well. But presumably when the bytes were collected from the finished movie's bitmap, the origins of the images are irrelevant?