Ok prob simple stuff for some of u, anyway this is the closest I got, ideally flash would pass a file name but that eluded me, but getting the save path back is close enough, you will have to wrap the flash code in a class if u use the code, but that should be easy. PS most of the code is a cosllation of blogs amd other open sources and I take no credit.
private function encode():void
{
_jpgSource = new BitmapData( _imageSource.width, _imageSource.height );
_jpgSource.draw( _imageSource );
_jpgEncoder = new JPGEncoder( COMPRESSION );
_jpgStream = _jpgEncoder.encode( _jpgSource );
}
private function send():void
{
_header = new URLRequestHeader("Content-type", "application/octet-stream");
_jpgUrlRequest = new URLRequest(_sendImagePath);//+"?name='snapshot.jpg'");
_jpgUrlRequest.requestHeaders.push( _header );
_jpgUrlRequest.method = URLRequestMethod.POST;
_jpgUrlRequest.data = _jpgStream;
_sendJpgLoader = new URLLoader();
_sendJpgLoader.addEventListener(Event.COMPLETE, onComplete);
_sendJpgLoader.dataFormat = URLLoaderDataFormat.TEXT;
_sendJpgLoader.load (_jpgUrlRequest);
}
private function onComplete( event: Event )
{
var loader:URLLoader = URLLoader( event.target );
var xml:XML = new XML( loader.data );
_txt.text = 'xml ' + xml.ServerPath;
}
<?php
if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
$location = 'uploads/testfile.jpg';
$fp = fopen( $location, 'w+' );
fwrite( $fp, $jpg );
if( fclose( $fp ) )
{
$message = "<result><Status>success</Status><ServerPath>$location</ServerPath></result>";
} else
{
$message = "<result><Status>fail</Status></result>";
}
echo $message;
}
?>