1

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);
Skeen
  • 4,614
  • 5
  • 41
  • 67
  • @@John, how would I use this to upload a string? – Skeen Sep 14 '11 at 15:33
  • @@John, can you post an answer, showing some example code of this, where data_string is a huge data_string. – Skeen Sep 14 '11 at 15:40
  • @@John, it's actually a BitmapData object, that is encoded into a string, I guess the encoding could happen server-side, if that would ease solving the sending issue. - So SWF local memory I guess. – Skeen Sep 14 '11 at 16:00
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/3447/discussion-between-john-giotta-and-skeen) – John Giotta Sep 14 '11 at 16:09

4 Answers4

0

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.

pythonjsgeo
  • 5,122
  • 2
  • 34
  • 47
0

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.

Community
  • 1
  • 1
Todd Moses
  • 10,969
  • 10
  • 47
  • 65
0

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?

Community
  • 1
  • 1
John Giotta
  • 16,432
  • 7
  • 52
  • 82
0

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.

Skeen
  • 4,614
  • 5
  • 41
  • 67