title: JavaScript Play Uploaded Audio
body: <p>How do I make it so that when audio is uploaded it can be played? I used this code, but it didn't work.</p>
  
  <pre><code>&lt;input type="file" id="audio" onchange="playFile(this)" /&gt;
  &lt;audio id="sound"&gt;&lt;/audio&gt;
  &lt;script type="text/javascript"&gt;
      function playFile(obj){
          var url=document.getElementById("audio").url;
          document.getElementById("sound").src=url;
          document.getElementById("sound").play()
      }
  &lt;/script&gt;
  </code></pre>