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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy a file to a FTP server 1

Status
Not open for further replies.

vjee

Programmer
Jan 16, 2002
23
BE
Hi,

I'm looking for a way to copy a file to an FTP server. It's not an FTP-server on the internet but on a LAN. I have an IP from a computer somewhere on the local area network of our company.
I tried it with the MS Internet Transfer control like this:

with ctlFTP
.Protocol = icFTP
.URL = "ftp://x.x.x.x/dir/dir/"
.UserName = "xxxxx"
.Password = "blabla"
.Execute , "PUT " & FromFile & " " & ToFile
end with

This returns "Command succesfully completed" or something like that as a returninfo, but the file is not copied to that location.

I can copy the file manually from an FTP session initiated from the Command prompt.

Is this the correct way to do it or are there other ways?

TIA
Bart
 
A couple of things you may want to take a look at. First, make sure that FromFile is a full pathname to the local file. Also, ToFile will be a pathname relative to the FTP root directory of the FTP server. The FTP root directory may not be the File System root on that machine, but may be some subdirectory underneath it.

Also, the Inet control cannot handle filenames which have embedded spaces in them. If your filename do have spaces, then you'll have to use the API functions for FTP transfer.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Included the path on the FTP host and the copy worked!

THX CajunCenturion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top