Answer the question
In order to leave comments, you need to log in
How to get Blob from input[type="files"]?
I want to attach a file to the constructed form:
var formData = new FormData();
... // Тут создаю нужные мне поля
formData.append("file", Blob, "test.mp3");
Answer the question
In order to leave comments, you need to log in
https://developer.mozilla.org/ru/docs/Web/API/File
File inherited from Blob
And why exactly Blob?
const file = document.querySelector('input[type="files"]').value;
formData.append("file", file, "test.mp3");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question