Magic User Group

Magic Wiki-Wakka : IntegratedFTPWithActiveX

HomePage :: CATEGORIES | Index :: Changes :: Comments :: Search :: Login/Register

FTP - Integrated ActiveX Solution

Prerequisites:

eDeveloper 9.4 or later.
Article initially written by Mark Bailey




After recently having the need to be able to upload a number of merged html pages to a remote web server repetitively every three minutes I tried a number of options, most of which were problematic. The FTP provided with Windows XP cannot use passive mode. Other tools did not allow the overwriting of files on the remote server. Others could not be used from a command line.

In the end I found a great little ActiveX control that was able to handle both of the above problems and also had a number of advantages. Firstly, it is FREE. Secondly, by using an ActiveX control it meant I did not have to do and Exit call and did not have to worry about external script files to handle the uploading.

Here is a step by step HOWTO to accomplish the task.

Step 1. Download the ActiveX Control.


Here is the link to download the Free version of the control....

http://www.chilkatsoft.com/download/FtpActiveX.msi

Here is the link to the reference page for the control...

http://www.chilkatsoft.com/refdoc/csFtpRef.html

Step 2. Run the install.


Double click on the downloaded file, FtpActivex.msi

This will install the control and register it for you. It will be installed in
	C:\Program Files\Chilkat Software Inc\Chilkat FTP\ChilkatFTP.dll

Step 3.


Start eDeveloper.

In a new Program, create a Virtual and call it x_FTP_ActiveX Select ActiveX for the Attribute. In the properties Select Chilkat FTP 3.0.0 for the Type Library. Make sure Instantiation = Automatic.

Let's assume this is variable 'A'VAR
Create another Virtual called v_Connect_Return Numeric 4
Let's assume this is variable 'B'VAR

Step 4.


Let us assume we wish to transfer all of the .html files from C:\MyLocalFolder on the local machine to /home/mysite/public_html onn the remote web server.

Say,
	 The host           = myserver.com
	 The username       = myusername
	 The PAssword       = mypassword

In the Task Prefix..
	 Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Set Property
	      Property      Hostname
	      Arguments     -
	      Value         Expression = 'myserver.com'

	 Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Set Property
	      Property      Passive
	      Arguments     -
	      Value         Expression = 1  //For True or 0 for False

	 Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Set Property
	      Property      Username
	      Arguments     -
	      Value         Expression = 'myusername'

	 Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Set Property
	      Property      Password
	      Arguments     -
	      Value         Expression = 'mypassword'

	 Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Call Method
	      Method        Connect
	      Arguments     -
	      Return Value  Var = B

	  Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Call Method
	      Method        ChangeRemoteDir
	      Arguments     Expression = '/home/mysite/public_html'
	      Return Value  -

	      Set the Condition Expression to B=1

	  Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Call Method
	      Method        MPutFiles
	      Arguments     Expression = 'C:/MyLocalFolder/*.html'
	      Return Value  -

	      Set the Condition Expression to B=1

	  Call  COM 
	      Object        A - x_FTP_ActiveX
	      Option        Call Method
	      Method        Disconnect
	      Arguments     -
	      Return Value  -

	      Set the Condition Expression to B=1

Step 5.

Check the program with F8 and assuming all went to plan try running the program, F7.

Hope this helps you avoid spending many hours as I did hunting an appropriate solution.

There are 2 comments on this page. [Display comments]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki trunk
Page was generated in 0.0794 seconds