3

I have an AS3 swf which users can upload jpg images to my EC2 instances which sit behind and Elastic Load Balancer. The jpg images are converted into bytearray data and sent using URLLoader.load(URLRequest)

I make 2 calls when uploading, one to upload a large version, then another to upload a thumbnail version. A PHP script to which the bytearray data is uploaded converts this to a file using file_put_contents($destination, $GLOBALS["HTTP_RAW_POST_DATA"])

Is it possible to combine these two requests into a single request which contains both the bytearray data for the large and thumbnail images and 'split' the HTTP_RAW_POST_DATA to create 2 files at the server. This would be better than uploading the bytearray for the large version then using something like ImageMagick to resize the resulting image into a thumbnail which I realise is another option.

any suggestions? cheers

hakre
  • 193,403
  • 52
  • 435
  • 836
undefined
  • 5,190
  • 11
  • 56
  • 90

1 Answers1

2

You can try with somethis like this: Multipart form data in as3 Class version 1.2

Cay
  • 3,804
  • 2
  • 20
  • 27
  • Similar questions have come up several times in the last week or two. Doing a multipart POST is the best way to handle this. There are a few libraries to handle this (calculating boundaries is a pain), but the one Cay mentions looks like a good option. – mpdonadio Jan 25 '11 at 18:38