469,592 Members | 2,032 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

Msxml2.XMLHTTP Takes Too Long To Upload File

Uploading from browser to server using Msxml2.XMLHTTP takes a long time about 15 minutes for a 1.5MB file at 37.2Kbps, although it does get there. Is there anyway to speed things up?

here's the code ...
var sFilename = (document.form1.myFileName.value);

// 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(sFilename);

// store file content into XML node

l_node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll

ado_stream.Close();

xml_dom.documentElement.appendChild(l_node1);

// send XML documento to Web server

var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");

xmlhttp.open("POST","http://www.mydomain.com/xmlupload.asp",false);

xmlhttp.send(xml_dom);
// show server message in message-area

div_message.innerHTML = xmlhttp.ResponseText;

--
Dan Sikorsky, MSCS BSCE BAB
Jul 19 '05 #1
3 11948
I assume you've compared this performance against major upload components,
such as aspupload and sa-fileup?

"Dan Sikorsky" <ds****@gte.net> wrote in message
news:#Y**************@TK2MSFTNGP12.phx.gbl...
Uploading from browser to server using Msxml2.XMLHTTP takes a long time
about 15 minutes for a 1.5MB file at 37.2Kbps, although it does get there.
Is there anyway to speed things up?

here's the code ...
var sFilename = (document.form1.myFileName.value);
// 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(sFilename);
// store file content into XML node
l_node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll
ado_stream.Close();
xml_dom.documentElement.appendChild(l_node1);
// send XML documento to Web server
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
xmlhttp.open("POST","http://www.mydomain.com/xmlupload.asp",false);
xmlhttp.send(xml_dom);
// show server message in message-area
div_message.innerHTML = xmlhttp.ResponseText;
--
Dan Sikorsky, MSCS BSCE BAB
Jul 19 '05 #2
No I haven't. I've had pretty good success developing components independent
of 3rd party products.

Am I getting better performance than your mentioned components?

Is MSXML2.XMLHTTP not the way to move 1 - 5 MB files around the Internet?
(If not: What is?)

My website(s) are hosted; in the beginning years of the Internet and ASP, a
phone call was all that was necessary to have the host register any of my
DLLs. But, they don't do that anymore - for security reasons. So, unless the
host already offers components for development use, and some do, I need pure
ASP code on my web pages.

I am also using similar logic - MSXML2.ServerXMLHTTP - to download files
from server to browser, and have yet to determine any performance issues
(which will likewise be posted in this newsgroup, as needed).

--
Dan Sikorsky, MSCS BSCE BAB
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:eE*************@tk2msftngp13.phx.gbl...
I assume you've compared this performance against major upload components,
such as aspupload and sa-fileup?

"Dan Sikorsky" <ds****@gte.net> wrote in message
news:#Y**************@TK2MSFTNGP12.phx.gbl...
Uploading from browser to server using Msxml2.XMLHTTP takes a long time
about 15 minutes for a 1.5MB file at 37.2Kbps, although it does get there.
Is there anyway to speed things up?

here's the code ...
var sFilename = (document.form1.myFileName.value);
// 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(sFilename);
// store file content into XML node
l_node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll
ado_stream.Close();
xml_dom.documentElement.appendChild(l_node1);
// send XML documento to Web server
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
xmlhttp.open("POST","http://www.mydomain.com/xmlupload.asp",false);
xmlhttp.send(xml_dom);
// show server message in message-area
div_message.innerHTML = xmlhttp.ResponseText;
--
Dan Sikorsky, MSCS BSCE BAB

Jul 19 '05 #3
> No I haven't. I've had pretty good success developing components
independent
of 3rd party products.
Well (and as you mention below), sometimes you have to use 3rd party
products because your own are not "trusted."
Am I getting better performance than your mentioned components?
I have no idea what performance you are getting or how you are measuring, so
I can't answer that question. All I'm suggesting is that you TRY the
various vendor components and compare, instead of assuming there's some way
to simply enhance your existing code and magically have improved
performance.
Is MSXML2.XMLHTTP not the way to move 1 - 5 MB files around the Internet?
(If not: What is?)
I would guess not. If you are uploading files from the client to the
server, a normal <form enctype=multipart/form-data and an upload component
on the receiving end will certainly be no worse, and might be better.
DLLs. But, they don't do that anymore - for security reasons. So, unless the host already offers components for development use,
Any host worth its salt has either ASPUpload, SAFileUp, or both. Drop their
tech support an e-mail. It's sad to see such a defeatist attitude...
I am also using similar logic - MSXML2.ServerXMLHTTP - to download files
from server to browser, and have yet to determine any performance issues
(which will likewise be posted in this newsgroup, as needed).


Why? How about ADODB.Stream and Response.BinaryWrite?

99.9% of the usage I've seen MSXML2.ServerXMLHTTP has been for retrieving
plain text, not for handling binary data. HTTP alone works fine for
transferring files, and there are several tried and true methods for doing
so that do not include MSXML2.ServerXMLHTTP.
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Roland Hall | last post: by
3 posts views Thread by BjörnHolmberg | last post: by
2 posts views Thread by noOby | last post: by
2 posts views Thread by Dave | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.