What Is The Form Input Type For Posting Blob From An Html Form?
I want to include a recorded video (saved as a blob) to a form that will be posted. Two questions: What is the input type required to post the blob? How do I assign the blob to
Solution 1:
I think the only way to attach a blob to a form is with a FormData() object.
var formData = new FormData();
formData.append("name", blob, filename);
and then sending the form using an XMLHttpRequest like:
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.send(formData);
So if you need to send this blob together with other form information you could instead attach the normal form data to your FormData object and send the whole thing. Or perhaps come up with some other solution like sending only the blob and have the server return a key associated to the upload which you then insert into a hidden element of your form, so when the the form is submitted normally your server can attach that data to the previously uploaded blob.
Post a Comment for "What Is The Form Input Type For Posting Blob From An Html Form?"