Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP with Internet Transfer Control OCX

Status
Not open for further replies.

KevinLentz

IS-IT--Management
Feb 9, 2003
2
US
I'm having problems connecting using Internet Transfer Control (ITC). Could someone provide me with sample code to connect, get a file from an ftp site, and put a file to an ftp site.

I don't seem to have the syntax correct. I get an "OLE IDispatch excpetion code 0 from Inet: Unable to connect to remote host." message when I try to use the "Execute" Method of this control.

Kevin Lentz
 
I haven't use PutFile, but here is my snippet for GetFile. I'm sure it would be quite similar:
Code:
WITH ThisForm
   .oInet.userName = ALLTRIM(.txtUserName.Value)
   .oInet.password = ALLTRIM(.txtPassword.Value)
   .oInet.URL      = "ftp://" + ;
      .oInet.userName + ;
      ":" + ;
      .oInet.password + ;
      '@' + ;
      ALLTRIM(.txtRemoteHost.Value)
      
   .oInet.Execute(.oInet.URL ,'GET ' + ;
         .txtRemoteFile.Value + .txtLocalFile.Value)
ENDWITH
WAIT WINDOW 'did.' TIMEOUT 3
As you can see, there are textboxes holding username, password, host, and source and target file names.
Dave S. [cheers]
 
Dave's code looks good to me -- very similar to my own.

Dave, I assume you will always have at least one trailing space at the end of .txtRemoteFile.Value. If not, you ought to insert one, otherwise the source and target filenames will run into each other. IOW:


.oInet.Execute(.oInet.URL ,'GET ' + ;
.txtRemoteFile.Value + " " + .txtLocalFile.Value)

Kevin, how does Dave's code compare with yours?

Mike

Mike Lewis
Edinburgh, Scotland
 
All,

Thanks for your help. After futher research, I scraped the Internet Transfer Control (ITC) ocx in favor of an FTP class I found on UniversalThread. The research I found indicated that the ITC had some problems. Anyway, I was able to get the FTP class operating. Thanks.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top