更新时间:2023-11-09 13:27:34
刚刚想通了.
我现在可以在 php 脚本中成功发送 flv byteArray,然后 php 接收它并将其保存为本地系统中的 flv 文件,然后使用 zend 框架将其上传到 *** 服务器.
I can now successfully send the flv byteArray in a php script where then the php receives it and save it as flv file in local system and uploading it in the *** server using zend framework.
这是我的 Flash 代码.
here's my code in flash.
//send byteArray to a php script
var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
var request:URLRequest = new URLRequest(url);
request.requestHeaders.push (header);
request.method = URLRequestMethod.POST;
request.data = fs; //FLV byteArray
var loader:URLLoader = new URLLoader();
trace(request.data);
loader.load(request)
以及接收并保存为flv文件的scipt:
and the scipt that receives and save it as a flv file:
$im = $GLOBALS["HTTP_RAW_POST_DATA"];
$fp = fopen("testVid.flv", 'w');
fwrite($fp, $im);
fclose($fp);
事实证明,我真的不需要像 JPEGEncoder 所做的那样对 byteArray 进行编码.虽然我在 Flash 和 php 方面还是很新的.我不知道这是否是我能拥有的***实践.一个建议将不胜感激.谢谢各位.
It turns out that I really dont need to encode the byteArray like what the JPEGEncoder is doing. Im still very new in flash and php though. And I have no idea if this is the best practice I can have. An advice would be greatly appreciated. Thanks guys.