title: How to save audio file from flash app to server using php?
body: <p>My problem is save the audio file (.wav) that my flash application generate when the user finish record your voice.</p>
  
  <p>I use, for this, the follow link: <a href="http://active.tutsplus.com/tutorials/actionscript/create-a-useful-audio-recorder-app-in-actionscript-3/" rel="nofollow">http://active.tutsplus.com/tutorials/actionscript/create-a-useful-audio-recorder-app-in-actionscript-3/</a></p>
  
  <p>But this only save the audio for the client. I need to change this for save on the server.</p>
  
  <p>Part of the code is (in MAIN.AS):</p>
  
  <pre><code>private function recordComplete(e:Event):void{
      fileReference.save(recorder.output, "recording.wav");
  }
  </code></pre>
  
  <p>Where the first argument (recorder.output) is my file and the second argument is the name of my file.</p>
  
  <p>I change this method for this:</p>
  
  <pre><code>private function recordComplete(e:Event):void{
    var urlReq:URLRequest = new URLRequest("extract_voice.php");
    urlReq.method = URLRequestMethod.POST;
    urlReq.contentType = "application/octet-stream";
    //var urlVars = new URLVariables();
    //urlVars.fileAudio = recorder.output;
    urlReq.data = recorder.output;
    //var loader:URLLoader = new URLLoader(urlReq);
    //loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.load(urlReq);
  }
  </code></pre>
  
  <p>And my extract_voice.php is:</p>
  
  <pre><code>$recorder = file_get_contents('php://input');
  $name = basename($recorder);
  $status = move_uploaded_file($recorder, 'http://localhost/recording/audiofiles/' . $name);
  if($status){
    echo 'WORK';
  }
  </code></pre>
  
  <p>But when stop the recording, always show me the popup for save the file on my machine. (client).But not in the server.</p>
  
  <p>Anyone can say me what I need to do? or if exist any other solution? (Like a RED5 but this doesn't work for me)</p>