I'm having an issue sending a huge (~4MB) block of data from flash, to my java servlet, currently I'm transferring the data using URLVariables, however it seems there's a limit to this (because it seems to work, with smaller data blocks), how do I suppress this limit, or in any other way, get my data to my servlet.
My flash code so far:
var variables:URLVariables = new URLVariables();
variables.name = name_string; //Plenty of these small attributes
variables.data = data_string; //And the huge BLOB
var sendReq:URLRequest = new URLRequest("http://localhost:8080/recieve/");
sendReq.method = URLRequestMethod.POST;
sendReq.data = variables;
var sendLoader:URLLoader;
sendLoader = new URLLoader();
sendLoader.addEventListener(Event.COMPLETE, Handler);
sendLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
sendLoader.load(sendReq)开发者_如何学C;
First, All POST methods fail at around 2000+ characters in IE (at-least prior to 8).
Next, there is a limit to the URLLoader
: see Flash/AS3 - is there a limit to the number of simultaneous URLLoader.load() requests?
If possible, try breaking your data up into smaller pieces and sending it that way. This will eliminate the maximum problems.
After looking into it, my earlier suggestion, FileReference, is a bad idea given the BitmapData is created within memory.
I will suggest trying How can I send a ByteArray (from Flash) and some form data to php?
So after playing around with flash, I came up with a solution;
I simply broke the data_string into sub-strings of a given size, then enumerating these, and transferring each of these using the URLLoader, along with a part_id.
The collection of the sub-strings is then done at server-side, by the part_ids.
This sounds more like an issue on the server side. Check your java environment settings and increase the maximum allowed POST/Request size.
The solution of breaking the data into multiple parts and sending them separately probably only works because each part is smaller than the server-side limit.
精彩评论