I am an AS3 developer, but I thought I might get more help posting my question here.
I have been successfully saving images from Flash through PHP to the server by posting a ByteArray to a simple PHP script that looks like this:
$fileName = $_GET['filename'];
$fp = fopen( "images/user_images/" . $fileName, 'wb' );
fwrite( $fp, $GLOBALS['HTTP_RAW_POST_DATA'] );
fclose( $fp );
The relavant AS3 looks like this:
var bytearray:ByteArray = jpgEncoder.encode(bitmapdata);
var urlRequest:URLRequest = new URLRequest("save_img.php?filename=" + filename);
urlRequest.contentType = "application/octet-stream";
urlRequest.method = URLRequestMethod.POST;
urlRequest.data = bytearray;
urlLoader = new URLLoader();
urlLoader.load(urlRequest);
The project is being reviewed for security and the client “doesn’t like” the PHP file. I’ve been asked to find another way. Is there another way to save a jpeg from Flash to the server? Please?