xmlhttp = new XMLHttpRequest(); ADOStream=new ActiveXObject("ADODB.Stream"); ADOStream.Type=1;//1=adTypeBinary ADOStream.Open(); ADOStream.LoadFromFile(FileItem.path); var binary=ADOStream.Read(); xmlhttp.open("POST","http://www.example.com/upload.php",true); xmlhttp.onreadystatechange = XHRFinished; xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xmlhttp.send(binary); //I get always "invalid argument" here ADOStream.Close();