software products and customization
Contact: support@xuebrothers.net ActiveWEBC Home Page

Sample Codes for Using ActiveWEBCC in JavaScript


var req=new ActiveXObject("ActiveWEBC.Request");
req.Method="POST";
req.Host="www.xuebrothers.net";
req.Path="/cgi-bin/upload_test.cgi";
req.AddFormText("user", "xue");
req.AddFormText("password", "12345");
req.AddFormFile("file1", "d:\\temp\\a.txt");
req.AddFormFile("file2", "d:\\temp\\b.zip");

var resp=req.DoRequest();
if(!resp)
{
	WScript.Echo(req.LastError);
}
else
{
	WScript.Echo(resp.GetHeader());
	var ct=resp.GetHeaderValue("Content-Type");
	if(ct.indexOf("text/")!=0 && ct.indexOf("message/")!=0)
	{
		WScript.Echo("The response body is none text. Dumpping skipped.");
	}
	else
	{
		WScript.Echo(resp.GetBody());
	}
}
The Screenshot of the Program