PDA

View Full Version : client-server


zzzeljc
06-10-2005, 01:42 AM
helo.

my name is zeljko, from slovenia. there is a little problem

the starting point is:
USING HTTP PUT TO UPLOAD TEXT DATA FROM THE IE CLIENT

it basicli has to disconect and reconect the server with ON/OFF buttons.
(CSS to servers)

I have the xml codes.

here is the html vbscript code:

----------------------
<HTML>
<HEAD>
<META NAME="Keyword" CONTENT="CSS Command Reference (Software Version )">
<TITLE>PUT</TITLE>
<link rel="stylesheet" type="text/css" href="stil.css">
</HEAD>

<script language="VBscript">

dim strURL
dim answer

on Error Goto 0


function sendit_off(sfileName1)
sData = getFileBytes(sfileName1)
sfileName1= mid(sfileName1, InstrRev(sFileName1,"\")+1,len(sfileName1))
dim xmlhttp
set xmlhttp=createobject("MSXML2.XMLHTTP.4")
strURL = "http://localhost/" & sFileName1

xmlhttp.Open "PUT", strURL, false
xmlhttp.Send sData
show.innerText= "Status: " & xmlhttp.statusText
set xmlhttp=Nothing
End function


function sendit_on(sfileName)

sData = getFileBytes(sfileName)
sfileName= mid(sfileName, InstrRev(sFileName,"\")+1,len(sfileName))
dim xmlhttp
set xmlhttp=createobject("MSXML2.XMLHTTP.4")
strURL = "http://localhost/" & sFileName

xmlhttp.Open "PUT", strURL, false
xmlhttp.Send sData
show.innerText= "Status: " & xmlhttp.statusText
set xmlhttp=Nothing
End function

function getFileBytes(flnm)
Dim objStream
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 2 ' adTypeText
objStream.Charset ="ascii"
objStream.Open
objStream.LoadFromFile flnm
getFileBytes= objStream.ReadText
objStream.Close
Set objStream = Nothing
end function
</script>

<BODY bgcolor="ffffff">
<FORM name="form">
<div class="naslov">content</div><br>
<div class="server">(server name)</div>
<TABLE align=left><br><br>
<TR><TD></TD></TR>
<TR><TD><input type=submit name="submit1" value="OFF" onclick="call sendit_off(sfilename1)">
<input type=submit name="submit2" value="ON" onclick="call sendit_on(sfilename)">
<div class="status">status</div></TD></TR>
</TABLE>
</FORM>
</BODY>
</HTML>

----------------------------

on the click it gives an error:
arguments are of the wrong type, are out of acceptable range, or are in conflict with one or another

the similar on gives an error:
ActiveX component can't create object: 'MSXML2.XMLHTTP.4'
from this one you can browse and select the xml file. it's easier then ON/OFF button, but it has to be that way.

so the first problem is more important.

thank you in advance.

zeljko, slovenia

zzzeljc
06-13-2005, 08:17 AM
it's ok

it was just the matter of proper line written. must be carefull with dots
msxml2.xmlhttp.4.0

ygl72
10-30-2005, 11:33 PM
Hi,

I tried the code but I'm getting this error:

ActiveX Component can't create object: "ADODB.Stream"

Can you help me how to make it work?

Thanks a lot!