我开发了一个flash和php应用程序..
我希望从flash上传音频到php .. [bytearray data]
var ogg_data_bytes:ByteArray = _oggManager.encodedBytes;
var request:URLRequest = new URLRequest ('http://ravialla.com/uploads/save.php?filename=myFileName');
var loader: URLLoader = new URLLoader();
request.contentType = 'application/octet-stream';
request.method = URLRequestMethod.POST;
request.data = ogg_data_bytes;
loader.addEventListener(ProgressEvent.PROGRESS, uploadProgress);
loader.addEventListener(Event.COMPLETE, fileUploadSuccess);
loader.addEventListener(IOErrorEvent.IO_ERROR, fileUploadFaild);
loader.load(request);
现在我通过$ _GET传递文件名..但我希望通过$ _POST传递文件名
任何想法???
感谢:)
答案 0 :(得分:0)
你能试试吗,
var loader : URLLoader = new URLLoader();
var request:URLRequest = new URLRequest ('http://ravialla.com/uploads/save.php');
request.method = URLRequestMethod.POST;
var variables : URLVariables = new URLVariables();
variables.key1 = myFileName;
variables.key2 = "value2";
request.data = variables;
// Handlers
loader.addEventListener(Event.COMPLETE, on_complete);
loader.load(request);
private function on_complete(e : Event):void{
// whatever
}
参考:http://scriptcult.com/archives_9/article_442-post-request-data-in-as3.htm