There is a form which uploads file to a web page:
<form method="POST" action="https://woodmin.catsone.com
/api/add_candidate" enctype="multipart/form-data">
<input name="resume" type="file">
</form>
I need to overwrite it in such way that the same thing would be done through XMLHttpRequest() but so far I haven't suceeded I would be gratefull if someone could tell me how can this be done. My currently code:
function send(){
var params=" resume=C://CV-Online.htm";
xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","https://woodmin.catsone.com /api/add_candidate",false);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader ("ENCTYPE", "multipart/form-data");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);
window.close()
}
Thank you in advance!


Reply With Quote
Bookmarks