Page 1 of 1

Ftp transfer

Posted: Tue Mar 09, 2010 10:21 am
by user1
I had two PCs.
One PC have winlog and visualbasic program.
Visual basic program create daily excel sheet.
The other PC have winlog only.
I need to transfer the daily excel sheet from the first PC to the second one using winlog FTP.
Please, tell us if it is possible (example for doing that).

Re: Ftp transfer

Posted: Tue Mar 09, 2010 2:58 pm
by Lorenzo
Here it is a sample code to tranfer a file via FTP with Winlog Code:

Function bool SendFTPFile()
//********************************************************************

string SourceFullPathFileName;
string DestFullPathFileName;
string FTPHost;
int Handle;


//**********************************
// Send a file in FTP mode.
//**********************************
FTPHost="1.2.3.4";
Handle=FTPConnect(21, // Gate for FTP file transfer
FTPHost, // Host
"SUserName", // Username to access FTP area
"Password", // Password to access FTP area
true, // Passive mode
10000); // Timeout
if (Handle>=0) then
DestFullPathFileName="/ftpGateway/MyFile.txt";
SourceFullPathFileName="C:\MyFile.txt";
FTPPut(Handle,SourceFullPathFileName,DestFullPathFileName ,1);
end
FTPDisconnect(Handle);
end

You can download application here:
viewtopic.php?f=20&t=73