I'm trying to upload a video to the Dailymotion API with ajax.
In my script i have :
//upload the video and get the url
var xhr = new XMLHttpRequest();
xhr.open('POST', upload_url, true);
var formData = new FormData(document.getElementById("myForm"));
xhr.send(formData);
My script is working but i have a problem, how can I specify which file field i want to use ?
If you see var formData = new FormData(document.getElementById("myForm"));, myForm is the entire form, if my file input has id="myInput", how can i specify that ?
I don't want to send all my form, but just one specific field.
Thanks !
<input type="file",if yes then you can use document.getElementById('myInput').files[0];