小弟目前在做一个网页录音的小东西
想用Flash实现
已经在AS中获取到了录音的文件对象
现不知如何上传至后台
后台使用的是Struts + Spring + Hibernate
在Action中的.do里面接不到所传参数
求解答,最好能有可参考的代码
部分代码如下:
AS中:
private function onRecordComplete(event:Event):void { _display.text = "Playing recorded sound."; player = new WavSound(recorder.output); //压缩 this.recorder.output.compress(); player.play(); //_file.upload(uploadUrl,uploadFileName,false); //_file.save( recorder.output, "recorded.wav" ); //上传操作 var url:URLRequest = new URLRequest(uploadUrl.url + "?testParam=1"); url.contentType = "application/octet-stream"; url.method = URLRequestMethod.POST; url.data = recorder.output; url.url += "?" + uploadFileName + "FileName=" + uploadFileName + "&" + uploadFileName + "ContentType=" + url.contentType; _display.text = "onRecordComplete_2:" + url.url; this.loader.dataFormat = URLLoaderDataFormat.BINARY; this.loader.addEventListener(Event.COMPLETE, this.completeHandler); this.loader.addEventListener(ProgressEvent.PROGRESS, this.progressHandler); this.loader.load(url); }
java:
private String recFileName; private File rec; private String recContentType; private String testParam; @Action(value="/recorder/RecordAction/upload") public String upload(){ System.out.println("----------upload begin-----------------"); if(rec!=null){ System.out.println("rec is not null"); } Struts2Utils.renderText("1"); System.out.println("----------upload end-----------------"); return null; }