I want to automate the uploading of a file to an ftp server external to our LAN (one of our clients). To test the application, I have first attempted to upload a test file to an ftp server on our company's LAN, one I have "write" privileges to.
I can manually upload the test file in 2 ways: 1) With the DOS shell ftp send command and 2)accessing the server through IE explorer and using "drag and drop". In both cases, I use a logon name and password that gives me this privilege.
In trying to create a program to automate this, I have added the Microsoft Internet Transfer Control to a visual basic form and use the following code in the Form Load event:
.AccessType = icUseDefault
.Protocol = icFTP
.URL = "ftp.lanserver.com
.Username = "username" 'same user name I use to manually upload the file
.Password = "password" 'same password I use to manually upload the file
"PUT c:\TestFile.txt /uploadedtest.txt"
I get back the error message: "Cannot connect with the server." If Ireplace the server URL with the IP address I get the same error.
If I replace the Execute statement with: ".Execute "PUT c;\TestFile.txt /uploadedtest.txt", relying on the Execute command to use the URL set previously, nothing happens. No upload and no error message.
I have also checked to make sure the TestFile.txt does indeed exist on the local C: drive.
Any ideas will be greatly appreciated.