I am using this GitHub project to record some audio on a website, I want to save that file in a folder instead of displaying it on the website. https://github.com/addpipe/simple-web-audio-recorder-demo
The current version is creating a download link and displaying the audio clip on the website, I've attempted to send the data to PHP using AJAX.
$.ajax({
url: "uploadAudio.php",
type: "POST",
data: "audio", blob,
processData: false,
contentType: false,
success: function(data){
alert('success');
}
});
and the PHP code I tried to save it as a file
<?php
$dir = "uploads/";
move_uploaded_file($_FILES["audio"]["tmp_name"], $dir. "name");
?>
Am I thinking along the right lines? have you got any suggestions for a better way of doing this?