0

Here is where I have established the .mp3 file as a file

const file = new File(buffer, 'audio.mp3', {
  type: blob.type,
  lastModified: Date.now()
});

How would I go about using the (const file variable) to pass it thru a form?

Deshunn
  • 13
  • 3
  • What in the world do you mean by pass a variable through a form? If you want to add it to a form's file input, use `document.querySelector("input[type=file]").files.push(file);` – Aluan Haddad Jul 11 '21 at 20:53
  • The const file is an object file, but the form wont accept it. – Deshunn Jul 11 '21 at 21:20
  • See [this answer](https://stackoverflow.com/a/66466855/19068) on the duplicate. – Quentin Jul 13 '21 at 14:27

1 Answers1

-1

If you mean to send it to a php page, thats not possible you wanna set a javascript object in a php $_POST or $_GET variable, thats not possible!

You could send it via ajax-call to your .php

elias.xe
  • 57
  • 7