I am using recorder.js. My goal is to upload recording to server, it seems like the audio blob is being posted to the server. But I keep getting null returned for $_FILES["file"]["tmp_name"];
Javascript:
function uploadAudio(){
audioRecorder.stop();
audioRecorder.exportWAV(function(audio) {
var fd = new FormData();
fd.append('filename', 'test.wav');
fd.append('data', blob);
$.ajax({
type: 'POST',
url: 'testthing.php',
data: fd,
processData: false,
contentType: false
}).done(function(data) {
console.log(data);
});
});
}
PHP:
$res="recordings/";
$yo = $_FILES["file"]["tmp_name"];
rename($yo,$res.'test.wav');
this is what I get for header data posted using firebug in firefox:
-----------------------------2600221228510
Content-Disposition: form-data; name="filename"
test.wav
-----------------------------2600221228510
Content-Disposition: form-data; name="data"; filename="blob"
Content-Type: audio/wav