<SCRIPT LANGUAGE=JavaScript>// files upload function function btn_send.onclick() { // create ADO-stream Object var ado_stream = new ActiveXObject("ADODB.Stream"); // create XML document with default header and primary node var xml_dom = new ActiveXObject("MSXML2.DOMDocument"); xml_dom.loadXML('<?xml version="1.0" ?> <root/>'); // specify namespaces datatypes xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes"); // create a new node and set binary content var l_node1 = xml_dom.createElement("file1"); l_node1.dataType = "bin.base64"; // open stream object and read source file ado_stream.Type = 1; // 1=adTypeBinary ado_stream.Open(); ado_stream.LoadFromFile("c:\\tmp\\myfile.doc"); // store file content into XML node l_node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll ado_stream.Close(); xml_dom.documentElement.appendChild(l_node1); // we can create more XML nodes for multiple file upload // send XML documento to Web server var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("POST","./file_recieve.asp",false); xmlhttp.send(xml_dom); // show server message in message-area div_message.innerHTML = xmlhttp.ResponseText; } </SCRIPT>这一段会不会出现客户端下载的提示阿?
可我现在急得像热锅的蚂蚁阿我记得ASP里好像可以用STREAM,但是问题是如何POST客户端的STREAM呢?
function btn_send.onclick()
{
// create ADO-stream Object
var ado_stream = new ActiveXObject("ADODB.Stream"); // create XML document with default header and primary node
var xml_dom = new ActiveXObject("MSXML2.DOMDocument");
xml_dom.loadXML('<?xml version="1.0" ?> <root/>');
// specify namespaces datatypes
xml_dom.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes"); // create a new node and set binary content
var l_node1 = xml_dom.createElement("file1");
l_node1.dataType = "bin.base64";
// open stream object and read source file
ado_stream.Type = 1; // 1=adTypeBinary
ado_stream.Open();
ado_stream.LoadFromFile("c:\\tmp\\myfile.doc");
// store file content into XML node
l_node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll
ado_stream.Close();
xml_dom.documentElement.appendChild(l_node1); // we can create more XML nodes for multiple file upload // send XML documento to Web server
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST","./file_recieve.asp",false);
xmlhttp.send(xml_dom);
// show server message in message-area
div_message.innerHTML = xmlhttp.ResponseText;
}
</SCRIPT>这一段会不会出现客户端下载的提示阿?
就可以不提示ACTIVEX的执行script呢?
我想了解一下htmlinputfile的原理谢谢思归老大
如果不嫌弃,请加我的MSN:[email protected]
我愿拜老大为师