title: Upload and Play Audio File JS
body: <p>I have an HTML audio tag and an HTML file input tag, as shown below. I'd like users to use the Upload File button to select a song from their computer, then play it using the audio tag.</p>
  <pre><code>&lt;audio id=&quot;audio&quot;&gt;
      &lt;source src=&quot;&quot; id=&quot;thesource&quot; /&gt;
  &lt;/audio&gt;
  &lt;input type=&quot;file&quot; id=&quot;upload&quot; title=&quot;Upload File&quot; /&gt;
  </code></pre>
  <p>How do I let users upload audio files from their computer and play it? This must be done locally, as it is being used in a downloadable web app I am creating.</p>
  <p>EDIT: Long ago, after lots of hard work and rediscovering past projects, I developed a solution to this question by converting some image-uploading code from one of my past projects into audio-uploading code. Now, years after I originally asked this question, I feel stupid for not realizing that answer earlier. I posted and edited the answer down below for any people who also need this.</p>