I have blob:http://unifiedmain.localhost.com/a4580f39-8f9d-4e8c-8e4b-02a6bd2df3df
url and i want to create actual file file from this.
I've used PHP code :
file_put_contents('E:\www\nginx\html\unifinedmainsite\123.mp3', file_get_contents($_REQUEST['id']));.
javascript code:
var xhr = new XMLHttpRequest;
xhr.responseType = 'blob';
xhr.onload = function() {
var recoveredBlob = xhr.response;
var reader = new FileReader;
reader.onload = function() {
jQuery.ajax({
type: "POST",
url: BASEURL+"/index.php?saveFileInSession=true",
data: "id="+reader.result,
success: function(response) {
console.log(response);
}
});
};
reader.readAsDataURL(recoveredBlob);
};
xhr.open('GET', 'blob:http://unifiedmain.localhost.com/a4580f39-8f9d-4e8c-8e4b-02a6bd2df3df');
xhr.send();
file is generating with actual size but i can not open it ,what is i am doing wrong?
Do i have to pass some header or something?so that i can play my saved/uploaded .mp3 file?
please help.