【发布时间】:2012-10-16 07:57:13
【问题描述】:
我的问题是保存我的 Flash 应用程序在用户完成录制您的声音时生成的音频文件 (.wav)。
但这只会为客户端保存音频。我需要更改它以保存在服务器上。
部分代码是(在 MAIN.AS 中):
private function recordComplete(e:Event):void{
fileReference.save(recorder.output, "recording.wav");
}
第一个参数 (recorder.output) 是我的文件,第二个参数是我的文件名。
我为此改变了这个方法:
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);
}
而我的 extract_voice.php 是:
$recorder = file_get_contents('php://input');
$name = basename($recorder);
$status = move_uploaded_file($recorder, 'http://localhost/recording/audiofiles/' . $name);
if($status){
echo 'WORK';
}
但是当停止录制时,总是向我显示将文件保存在我机器上的弹出窗口。 (客户端)。但不在服务器中。
谁能告诉我我需要做什么?或者是否存在任何其他解决方案? (就像 RED5,但这对我不起作用)
【问题讨论】:
标签: php flash audio-recording