# Need to use flash vars to name file in php

**URL:** <https://forum.kirupa.com/t/need-to-use-flash-vars-to-name-file-in-php/331063>\
**Category:** flash\
**Created:** [May 7, 2013, 3:20am UTC](https://forum.kirupa.com/t/need-to-use-flash-vars-to-name-file-in-php/331063 "2013-05-07T03:20:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aphexhx](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@aphexhx](https://forum.kirupa.com/u/aphexhx)\
**Post date:** [May 7, 2013, 3:20am UTC](https://forum.kirupa.com/t/need-to-use-flash-vars-to-name-file-in-php/331063/1 "2013-05-07T03:20:07Z")

</div>

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.

```auto
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
<?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!

```auto
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

```php
file_put_contents($_POST['currentName'], $_POST['videoData']);

```

Nothing works 😕
