title: How to save audio data getting from blob url into file system and path in mysql db
body: <p>Hi i want to save a audio file path into database and audio file into my upload folder here is my code:-</p>
  
  <pre><code>&lt;a class="btn btn-large btn-danger" id="ahref" target="_blank" onclick="$('#audioLayerControl')[0].save($('#ahref')[0]);"&gt;&lt;i class="icon-fire"&gt;&lt;/i&gt; save&lt;/a&gt;
  </code></pre>
  
  <p>When i clicked on this link my audio which is recorded by me is saved in downloads folder and i can play it but i want to save it in my uploads folder i am getting blob url like this <code>blob:http%3A//localhost%3A8383/0dd9e04b-d6db-4c8c-94b5-51cfb619f725</code> here is its script :-</p>
  
  <pre><code>this.save = function save(saveLink)
      {
          var url = this.toWave().toBlobUrlAsync("application/octet-stream");
  
         document.getElementById("ahref").src=url;    
       var final=document.getElementById("ahref").download = new Date().toISOString() + '.wav';
  
      };
  </code></pre>
  
  <p>Thank you please help me.</p>
  
  <p><strong>Updated</strong> After using Ajax</p>
  
  <pre><code>var blobUrl=url;    
  
      var xhr = new XMLHttpRequest;
  xhr.responseType = 'blob';
  
  xhr.onload = function() {
     var recoveredBlob = xhr.response;
  
     var reader = new FileReader;
  
     reader.onload = function() {
       var blobAsDataUrl = reader.result;
       window.location = blobAsDataUrl;
     };
  
     reader.readAsDataURL(recoveredBlob);
  };
  
  //xhr.open('GET', blobUrl);
   xhr.open('POST', 'upload.php', true);
  
  xhr.send(blobUrl);
  </code></pre>
  
  <p><strong>Upload.php</strong></p>
  
  <pre><code>&lt;?php
  
  error_reporting(0);
  
     if( isset($HTTP_RAW_POST_DATA))
     {
  
     echo  $cad = $HTTP_RAW_POST_DATA;
  
     } 
  
  ?&gt;
  </code></pre>
  
  <p>Ouput:-<code>blob:http%3A//localhost%3A8383/5155c610-dec6-4e60-8ef7-e14a56aa73d2</code></p>
  
  <p>and in the browser url is <code>data:text/html;base64,YmxvYjpodHRwJTNBLy9sb2NhbGhvc3QlM0E4MzgzLzUxNTVjNjEwLWRlYzYtNGU2MC04ZWY3LWUxNGE1NmFhNzNkMg==</code></p>