Try to search your question here, if you can't find : Ask Any Question Now ?

Upload audio file from browser to AWS S3 not working

HomeCategory: stackoverflowUpload audio file from browser to AWS S3 not working
Avatarkundan asked 4 months ago

I am recording audio data (saved as a .wav file) from my browser and attempting to upload it to an AWS S3 bucket with ajax.

The code is working in that it is making it to the AWS S3 bucket, but once in the bucket, the files appear to be empty and when downloaded, are not playing anything.

I am using formData to append the data of the blob file, and when i console.log out my blob file, I can see it’s an audio/wav file type and how big the contents of the file is. So to me, it seems like that part is working, and i can play the file in the browser.

Here is my ajax request which is triggered from an onClick event

 upload.addEventListener("click", function(event){

  var formData = new FormData();
  formData.append('file', blob, filename);

  $.ajax({
    type: 'PUT',
    crossDomain: true,
    url: uploadPreSignedUrl,
    contentType: 'binary/octet-stream',
    processData: false,
    data: formData
  }).success(function(success) {
    console.log('success', success);
  }).error(function(error) {
    console.log('error', error)
  })
})

Does anyone see potentially why the form data I’d be attaching to the ajax request would be showing up as empty on AWS S3? I can attach more code if needed

Any help is very appreciated!

1 Answers
Best Answer
Avatarnaveen answered 4 months ago
Your Answer

11 + 15 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com