My problem is save the audio file (.wav) that my flash application generate when the user finish record your voice.
I use, for this, the follow link: http://active.tutsplus.com/tutorials/actionscript/create-a-useful-audio-recorder-app-in-actionscript-3/
But this only save the audio for the client. I need to change this for save on the server.
Part of the code is (in MAIN.AS):
private function recordComplete(e:Event):void{
fileReference.save(recorder.output, "recording.wav");
}
Where the first argument (recorder.output) is my file and the second argument is the name of my file.
I change this method for this:
private function recordComplete(e:Event):void{
var urlReq:URLRequest = new URLRequest("extract_voice.php");
urlReq.method = URLRequestMethod.POST;
urlReq.contentType = "application/octet-stream";
//var urlVars = new URLVariables();
//urlVars.fileAudio = recorder.output;
urlReq.data = recorder.output;
//var loader:URLLoader = new URLLoader(urlReq);
//loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(urlReq);
}
And my extract_voice.php is:
$recorder = file_get_contents('php://input');
$name = basename($recorder);
$status = move_uploaded_file($recorder, 'http://localhost/recording/audiofiles/' . $name);
if($status){
echo 'WORK';
}
But when stop the recording, always show me the popup for save the file on my machine. (client).But not in the server.
Anyone can say me what I need to do? or if exist any other solution? (Like a RED5 but this doesn’t work for me)
$recordervariable holds binary data fetched from php input, not uploaded file. Instead ofuse:
Note, that path to the file must be writable to web server, and it must be local path, not some web address.