rob_botch
Full Member
Posts: 180 Reputation: 4
34 / /
Joined: Apr 2006
|
RE: Upload to FTP
OK. Please forgive me if this is wrong in any way! This is ripped from my script.
Variables at the top:
code: var XMLPath = MsgPlus.ScriptFilesPath+ "\\file.xml";
var ConfigServer = "";
var ConfigPort = 21;
var ConfigUsername = "";
var ConfigPassword = "";
var ConfigDirectory = "";
var ConnectionHandle;
To open a connection:
code: ConnectionHandle = Interop.Call('wininet', 'InternetOpenW', 'ScriptName', 0, 0, 0, 1);
And to upload:
code: try
{
var result = Interop.Call('wininet', 'InternetConnectW', ConnectionHandle, ConfigServer, ConfigPort, ConfigUsername, ConfigPassword, 1, 1, 0);
var test = Interop.Call('wininet', 'FtpSetCurrentDirectoryW', result, ConfigDirectory);
var test = Interop.Call('wininet', 'FtpPutFileW', result, XMLPath, "file.xml", 2, 0);
Interop.Call('wininet', 'InternetCloseHandle', result);
MsgPlus.DisplayToast("","Uploaded"); // Only for debugging!
}
catch(err)
{
MsgPlus.DisplayToast("", "Error");
}
Hope this helps
Robert
|
|