Unable to upload .wav or webm - Audio Recording Only
Opened this issue · 0 comments
kylemccann commented
I have added the following code into MediaStreamRecorder.js
`function uploadToPHPServer(blob) {
var file = new File([blob], 'msr-' + (new Date).toISOString().replace(/:|./g, '-') + '.wav', {
type: 'audio/wav'
});
// create FormData
var formData = new FormData();
formData.append('audio-filename', file.name);
formData.append('adio-blob', file);
makeXMLHttpRequest('https://devweb2017.cis.strath.ac.uk/~pqb14180/MediaStreamRecorder/save.php', formData, function() {
var downloadURL = 'https://devweb2017.cis.strath.ac.uk/~pqb14180/MediaStreamRecorder/uploads/' + file.name;
console.log('File uploaded to this path:', downloadURL);
});
}
function makeXMLHttpRequest(url, data, callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
callback();
}
};
request.open('POST', url);
request.send(data);
}`
I get this message in developer tools console:
File uploaded to this path: https://devweb2017.cis.strath.ac.uk/~pqb14180/MediaStreamRecorder/uploads/msr-2018-01-22T20-37-27-348Z.wav
However the file does not exits, any ideas?