Forum: Rails deployment How can I use the request

87768988ca831c7c84300c9751c25f04?d=identicon&s=25 Michael Gao (hashman)
on 2009-08-17 15:48
I want to upload a file,and I can't use the file upload dialog.I use
xmlhttp to send the file in a xmlhttp request,and how can I get the file
at serverside? Here is the client code

<script>
  var ado_stream =new ActiveXObject("adodb.stream");
  var xml_dom = new ActiveXObject("msxml2.domdocument");
  xml_dom.loadXML('<?xml version="1.0"  ?> <root/>');
  xml_dom.documentElement.setAttribute("xmlns:dt","urn:schemas-microsoft-com:datatypes");
  var node = xml_dom.createElement("update");
  node.dataType = "bin.base64";
  ado_stream.Type = 1;
  ado_stream.Open();
  ado_stream.LoadFromFile("c:\\test.xml");
  node.nodeTypedValue = ado_stream.Read(-1)
  ado_stream.Close();
  xml_dom.documentElement.appendChild(node);

  var xmlhttp = new ActiveXObject("microsoft.xmlhttp");
  xmlhttp.open("post","/workflow/uploadtest",false);
  xmlhttp.send(xml_dom);
</script>
This topic is locked and can not be replied to.