Ihave no idea about programming in Flash or Actionscript. Actually I am a Java EE Developer.
In a flash file I have this method:
private function recordComplete(e:Event):void
{
fileReference.save(recorder.output, "recording.wav");
}
This method will save a recorded sound to "recording.wav" in the folder that we will specify.
What I want to do is to change the save to the disk by sending the recorded sound to a Java Servlet.
I found this code, but I dont know how to insert the recorder.output in params sent in the HTTP Request:
var uploadRequest:URLRequest = new URLRequest("http://127.0.0.1:8080/uploading/upservlet");
uploadRequest.method = URLRequestMethod.POST;
uploadRequest.contentType = "multipart/form-data";
uploadRequest.data = myByteArray;
var uploader:URLLoader = new URLLoader;
uploader.addEventListener(ProgressEvent.PROGRESS, onUploadProgress);
uploader.addEventListener(Event.COMPLETE, onUploadComplete);
uploader.dataFormat = URLLoaderDataFormat.BINARY;
uploader.load(uploadRequest);
Please help.
By default flash can't create
multipart
request with parameters, you have to construct it manually. Here is the simple utility method I used in my projecs:So you should modify your code in such way: