0

我需要保存用户的音频文件并给它一个唯一的名称。音频代码正在运行,但我没有成功发送文件名。有什么建议么?

闪码:

function onSave():void
{
soundO.position=0;
testAudio=enco.encode(soundO,1);
file.save(testAudio,Subject+".wav");

var req:URLRequest = new URLRequest('upload.php');
var loader:URLLoader = new URLLoader();
req.contentType = 'application/octet-stream';
req.method = URLRequestMethod.POST;
req.data = testAudio;
loader.load(req);
}

PHP 代码

<?php
$fp = fopen( 'filename.wav', 'wb' );
fwrite($fp, file_get_contents('php://input'));
fclose( $fp );
?>

谢谢!

4

0 回答 0