Skip navigation
Currently Being Moderated

Upload bytearray problem

May 20, 2013 8:16 AM

Tags: #flex #mobile

Hi,

 

I hope someone can help me after hours of forum reading and struggling...

 

I have a byte array resulting from an microphone recording in a flex mobile project.

I want to save this as a .wav file on the server.

I have to use UrlLoader since I don't have a file reference

 

this is my code:

 

private function uploadAudio(data:ByteArray):void

{

                                        var urlVariables:URLVariables = new URLVariables();

                                        urlVariables.filename = "myFile.wav";

                                        urlVariables.file = data;

 

  var url:String = "http://myDomain/audioUploader.php";    

                                        var urlRequest:URLRequest = new URLRequest(url);   

                                        urlRequest.method = URLRequestMethod.POST;  

                                        urlRequest.data = urlVariables;

 

                                        urlLoader = new URLLoader();  

  //urlLoader.dataFormat = URLLoaderDataFormat.BINARY;

                                        urlLoader.addEventListener(Event.COMPLETE, completeHandler);

                                           

                                        urlLoader.load(urlRequest);

}

 

 

Watching Charles to monitor server traffic, I can see that urlVariables.file is empty even before going to the server. In debugging mode however, urlVariables.file holds the byteArray.

 

Any idea what I'm doing wrong here?

 

Thx,

 

Dany

 
Replies
  • Currently Being Moderated
    May 22, 2013 1:30 PM   in reply to archemedia

    Have you tested with the filereference? May you can try with the data property of it, and on he server you can get it as a stream. Dunno howiit works with php

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points