title: Upload an audio blob to AWS S3 Using Amplify
body: <p>I'm trying to convert a Blob media to a file before uploading it to an AWS S3.</p>
  <p>Underneath a simplified version of the code in React.</p>
  <pre class="lang-js prettyprint-override"><code>const Audio2S3= async (blb)=&gt;{
  const file= await fetch(blb).then(
      r=&gt;r.blob()
  ).then(
      blobFile=&gt; new File([blobFile], &quot;audio1.mp3&quot;,{
          type:&quot;audio/mpeg&quot;
      })
  );
  try {
    await Storage.put(&quot;Audio_test&quot;, file, {
      // await Storage.put(`${Date.now()}-${file}`, file, {
    
        contentType:&quot;audio/mpeg&quot;,
        level:&quot;protected&quot;
    })
  } catch (err) {
    console.log(&quot;File upload Error&quot;, err);
  }
  
  const AudioS3 = () =&gt; (
    &lt;div&gt;
      &lt;ReactMediaRecorder
        audio
        whenStopped={(blobUrl) =&gt; console.log(blobUrl)}
        render={({ status, startRecording, stopRecording, mediaBlobUrl }) =&gt; (
          &lt;div&gt;
            &lt;p&gt;{status}&lt;/p&gt;
            &lt;button onClick={startRecording}&gt;Start Recording&lt;/button&gt;
            &lt;button onClick={stopRecording}&gt;Stop Recording&lt;/button&gt;
            &lt;audio src={mediaBlobUrl} controls autoPlay /&gt;
  
            &lt;button onClick={AplS3(mediaBlobUrl)}&gt;Upload Recording&lt;/button&gt;
          &lt;/div&gt;
        )}
      /&gt;
    &lt;/div&gt;
  );
  export default AudioS3;
  </code></pre>
  <p>Though I managed to get the file on  S3 bucket, the file is not and audio track and unusable.
  <a href="https://i.stack.imgur.com/v0Wuz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v0Wuz.png" alt="enter image description here" /></a></p>
  <p>The Network tracking on Inspect Element depicts the file chunks encoding before the upload to S3:
  <a href="https://i.stack.imgur.com/JNsX2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JNsX2.png" alt="enter image description here" /></a></p>
  <p>Something wrong with the <strong>blob</strong> conversion to <em>file</em> I guess but I did not know how to fix it after consulting many references.</p>