I have the following Form which I would like to send via an AJAX request. I am unsure how to proceed in the line 'xmlhttp.open'. I am trying to upload a video file to a third party video hosting site (using their API)and they have provided me with a URL ('upload_link_secure')to upload the file to. Please can someone advise?
my HTML:
<form id="upload" action="'+upload_link_secure+'" method="PUT" enctype="multipart/form-data">
<input type="file" id="vidInput">
<button type="submit" id="submitFile" onclick="uploadMyVid(\''+upload_link_secure+'\')">Upload Video</button>
</form>
my javascript:
var uploadMyVid = function(upload_link_secure){
var form = document.getElementById('upload')
// FETCH FILEIST OBJECTS
var vidFile = document.getElementById('vidInput').files;
var xmlhttp = new XMLHttpRequest;
xmlhttp.open('PUT', ); // NOT SURE HOW TO COMPLETE THIS LINE???
xmlhttp.send(vidFile);
}
.open(method, url)so you have to add the URL to upload to.<form>orXMLHttpRequest()?