Upload an Audio File From Ionic
<p>I am having problems uploading a file with CordovaFileTransfer plugin in ionic. 
I have sound file that has been recorded and i need help uploading it.</p>

<pre><code>var targetPath = e.nativeURL;

var win = function (r) {
  console.log("Code = " + r.responseCode);
  console.log("Sent = " + r.bytesSent);
}

var fail = function (error) {
  alert("An error has occurred: Code = " + error.code);
  console.log("upload error source " + error.source);
  console.log("upload error target " + error.target);
}

var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=filename;
options.mimeType="audio/wav";

var params = new Object();
params.value1 = "test";
params.value2 = "param";

options.params = params;
options.chunkedMode = false;

var ft = new FileTransfer();
ft.upload(targetPath, "http://example.come/upload.php", win, fail, options);
</code></pre>

<p>And my php script looks like this </p>

<pre><code>header('Access-Control-Allow-Origin: *');

print_r($_FILES);
$new_image_name = "audio.wav";
move_uploaded_file($_FILES["file"]["tmp_name"], "/var/www/html/snappycast_uploads/files/".$new_image_name);
</code></pre>

<p>Have any idea what I am doing wrong??</p>