************************************************** *-- Class: pspftp (c:\vfp9lib\classes\pspftp.vcx) *-- ParentClass: custom *-- BaseClass: custom *-- Time Stamp: 01/23/07 11:51:05 AM * #INCLUDE "c:\vfp9lib\classes\pspftp.h" * DEFINE CLASS pspftp AS custom *-- Flag used for the Dir Listing currently in aDirItems cfileordir_dirlisting = "" *-- When a connection is established, cHostname, cUsername, and cPassword are filled in automatically. chostname = "" clasterrorhtml = "" clasterrortext = "" clasterrorxml = "" *-- Filled in when a connection is made cpassword = "" *-- Session log kept if the lKeepSessionLog property is set. csessionlog = "" *-- Filled in when a connection is made cusername = "" *-- The CaseMatters flag that pertains to the current dir listing contained in aDirItems lcasematters_dirlisting = .F. *-- Whether the FTP object is currently connected to the host. lconnected = .F. *-- Accessing resets to .F.: be sure to check after each routine that doesn't return success (e.g., directory_change()) lerror = .F. *-- If set to .t., keeps a session log that can be retrieved from the cSessionLog property lkeepsessionlog = "" Name = "pspftp" *-- Number of directory items retrieved on the last Directory Listing by the FTP object; corresponds to number of rows in aDirItems ndiritems = 0 *-- Holds the FTP COM object oftp = "" *-- Holds the directory items; #defines are in pspftp.h DIMENSION adiritems[1,1] PROCEDURE chostname_access *To do: Modify this routine for the Access method RETURN THIS.oFTP.Hostname ENDPROC PROCEDURE chostname_assign LPARAMETERS vNewVal *!* *To do: Modify this routine for the Assign method *!* THIS.chostname = m.vNewVal ENDPROC PROCEDURE clasterrorhtml_access *To do: Modify this routine for the Access method RETURN THIS.oFTP.LastErrorHTML ENDPROC PROCEDURE clasterrortext_access *To do: Modify this routine for the Access method RETURN THIS.oFTP.LastErrorText ENDPROC PROCEDURE clasterrortext_assign LPARAMETERS vNewVal *!* *To do: Modify this routine for the Assign method *!* THIS.clasterrortext = m.vNewVal ENDPROC PROCEDURE clasterrorxml_access *To do: Modify this routine for the Access method RETURN THIS.oFTP.LastErrorXML ENDPROC PROCEDURE clasterrorxml_assign LPARAMETERS vNewVal *!* *To do: Modify this routine for the Assign method *!* THIS.clasterrorxml = m.vNewVal ENDPROC *-- Connect to a site, with username and password if required. PROCEDURE connect_to LPARAMETERS tcSite, tcUserName, tcPassword tcSite = IIF(UPPER(tcSite) = "FTP://",SUBSTR(tcSite,7),tcSite) tcUserName = Param_Val(tcUserName, "") tcPassword = Param_Val(tcPassword, "") THIS.oFTP.HOSTNAME = tcSite THIS.oFTP.Username = tcUserName THIS.oFTP.PASSWORD = tcPassword IF !THIS.oFTP.CONNECT() = 1 RETURN .F. ENDIF RETURN THIS.oFTP.ConnectVerified() = 1 ENDPROC... it continues on from here. This comes from a VCX, but I instantiate it using NewObject in the programs.