Use the Microsoft Internet Transfer Control on a form (I'll call it "Inet1").
Thisform.Inet1.Protocol = 2 && FTP
** Set the IP address or the DNS name of remote server
Thisform.Inet1.RemoteHost = "255.255.255.255"
** Set the port on which the FTP server is listening
Thisform.Inet1.RemotePort = 21 && Standard FTP port
** Set the Username and Password
Thisform.Inet1.Username = "USERNAME"
Thisform.Inet1.Password = "PASSWORD"
** Connect to the remote server and wait 'til done connecting
Thisform.Inet1.Execute()
Do While Thisform.Inet1.StillExecuting
Enddo
** Connected after this point
** You can check the data returned from the FTP server for
** validation or errors
** Wait Window Thisform.Inet1.ResponseInfo && or something
** After connection, send file
** The first parameter is to tell the control where to send the command
** (an IP or hostname address), but since we're connected, we don't need
** it here.
Thisform.Inet1.Execute(, "PUT c:/file/to/put.ext c:/place/to/put.ext")
Do While Thisform.Inet1.StillExecuting
Enddo
** Wait Window Thisform.Inet1.ResponseInfo && or something
** Finish session
Thisform.Inet1.Execute(, "QUIT")
I've used this control w/o problem. For some reason, everybody else insists on using third-party controls. The MS Inet Xfer Control not only works for me, but it's free.
Phillip Perkins
PS I'm doing this code off the top of my head, so it may not be totally correct. If you have any trouble, I will look up my code (whereever I have it buried.)
"D'OH!" --Homer Simpson