title: How to record voice using Flash and save to PHP
body: <p>The following are done work<br><br>
  <strong>Get WAV file => OK</strong></p>
  
  <pre><code>private function renderWav(src, convertToMp3 = false) {
      WaveFile.writeBytesToWavFile(myWavFile, myWavData, 44100, 2, 16)       
  }
  </code></pre>
  
  <p><strong>Convert to MP3 => OK</strong></p>
  
  <pre><code>private function makeIntoMp3(wav) {
      mp3Encoder = new ShineMP3Encoder(wav);
      mp3Encoder.start();
  }
  </code></pre>
  
  <p><strong>save MP3 file to Client => OK</strong></p>
  
  <pre><code>private function onWavClick(e:MouseEvent) {
     new FileReference().save(mp3Encoder.mp3Data, "MyAudio.mp3");
  }
  </code></pre>
  
  <p>Above, I can get a MP3 file in client side but on my problem that save to Server side(PHP)</p>
  
  <p><strong>Save to server side => Fail</strong></p>
  
  <pre><code>public function makeMP3File() {
     var urlVariables:URLVariables = new URLVariables;
     urlVariables.mp3Data = mp3Encoder.mp3Data;           
     var req:URLRequest = new URLRequest('upload.php');
     req.data = urlVariables;
     req.method = URLRequestMethod.POST;
     var loader:URLLoader = new URLLoader();
     loader.load(req);
  }
  </code></pre>
  
  <p><strong>My PHP Code</strong></p>
  
  <pre><code>function strean2audio($audioStream, $filename)
  {
     $file = fopen($filename . '.mp3', "wb");
     fwrite($file, $audioStream);
     fclose($file);
  }
  </code></pre>
  
  <p>I was a ActionScript rookie, don't know which part error, <strong><em>thanks for your help!</em></strong></p>