Return to Snippet

Revision: 53488
at November 24, 2011 22:42 by kiroweb

Initial Code
//-- your byte array you want to save
var bytes: ByteArray = new ByteArray();

//-- set up correct url request using post in binary mode
var request:URLRequest = new URLRequest ( 'http://pathto/save.php' );
var loader: URLLoader = new URLLoader();
request.contentType = 'application/octet-stream';
request.method = URLRequestMethod.POST; = bytes;
loader.load( request );

And of course you need a PHP file like this:

$fp = fopen( 'file.txt', 'wb' );
fwrite( $fp, $GLOBALS[ 'HTTP_RAW_POST_DATA' ] );
fclose( $fp );

Initial URL

Initial Description
A short snippet of code to save a ByteArray into any file

Initial Title
Save ByteArray to file with PHP

Initial Tags
php, actionscript

Initial Language