Created
July 15, 2016 02:43
-
-
Save liximomo/0e57a5a49eb207798437ea1a067e1177 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uploadAudio(mp3Data){ | |
var reader = new FileReader(); | |
reader.onload = function(event){ | |
var fd = new FormData(); | |
var mp3Name = encodeURIComponent('audio_recording_' + new Date().getTime() + '.mp3'); | |
console.log("mp3name = " + mp3Name); | |
fd.append('fname', mp3Name); | |
fd.append('data', event.target.result); | |
$.ajax({ | |
type: 'POST', | |
url: 'upload.php', | |
data: fd, | |
processData: false, | |
contentType: false | |
}).done(function(data) { | |
//console.log(data); | |
log.innerHTML += "\n" + data; | |
}); | |
}; | |
reader.readAsDataURL(mp3Data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment