hello, I’m having issues setting a file name for an flv in PHP using flash vars . I’ve tried multiple methods and nothing works. I believe the issue to be with how the data is sent to php, using urlLoader.dataFormat = URLLoaderDataFormat.BINARY; which I can’t attach vars from flash to without it compiling all the data into an flv.
Here is my AS3 code.
var url_ref:URLRequest = new URLRequest("save_flv.php");
url_ref.contentType = 'application/octet-stream';
url_ref.data = _baFlvEncoder.byteArray;
url_ref.method = URLRequestMethod.POST;
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
try {
urlLoader.load( url_ref );
} catch (e:Error) {
trace(e);
}
And the php code I’m using.
<?php
file_put_contents("testNEW.flv",$GLOBALS[ 'HTTP_RAW_POST_DATA' ]);
?>
This works fine, saving an flv named testNew.flv but I need to dynamically set that name using vars set in flash by the user. Can anyone tell me how I should structure my php file to get these vars and if there is another way to use the byteArray data for the flv then the $GLOBALS[ 'HTTP_RAW…etc. ? Please halp!
urlVars.currentName = currentName;
urlVars.videoData = _baFlvEncoder.byteArray;
var url_ref:URLRequest = new URLRequest("save_vid.php");
url_ref.contentType = 'application/octet-stream';
url_ref.data = urlVars;
url_ref.method = URLRequestMethod.POST;
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
and this php
file_put_contents($_POST['currentName'], $_POST['videoData']);
Nothing works