Loop and PutFile - WeOnlyDo Discussion board

Loop and PutFile (General questions)

by segosambel, Wednesday, April 04, 2007, 13:06 (6444 days ago)

I have a problem about PutFile (C# Application)

example code
===============================
public void SendToFTPServer()
{
wodFtpDLXComClass wod = new wodFtpDLXComClass();
wod.Login = fConf.LoginFtp;
wod.Password = fConf.PwdFtp;
wod.Passive = true;
wod.StrictHost = true;
wod.Blocking = true;
wod.LicenseKey = XXXX-XXX-XXXX-XXXX ; // ===> Hide

try
{
switch (fConf.Protocol.ToLower())
{
case ftp :
wod.Connect(fConf.Host, fConf.Port, ProtocolsEnum.FTP);
break;
case ftpsimplicit :
wod.Connect(fConf.Host, fConf.Port, ProtocolsEnum.FTPSimplicit);
break;
default:
return;
}

for(i=1;i<=2;i++)
{
try
{
wod.PutFile( D:\ftp\ftp\bin\Debug\setting\example.txt , / +i.toString());
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}
}

try
{
wod.Disconnect(null);
}
catch
{
throw new Exception();
}
}
catch
{
throw new Exception();
}
}


result, just first file or one result file transfered is /1 (example.txt on server), but the second file
fail transfered /2 . error Requested Action Not Taken, File Unavailable(e.g., file not found, no access)

How about it?? thankz a lot.......

Re: Loop and PutFile

by woddrazen, Wednesday, April 04, 2007, 13:47 (6443 days ago) @ segosambel

Hi,


Your code looks fine. Are you sure that you use correct full path for local and remote path.

What is value of RemotePath Property just after you connect to server?

Can you try to upload file without loop, something like this:
[code]
wod.PutFile( D:\ftp\ftp\bin\Debug\setting\example.txt , /home/something/1”);
[/code]

What is result?

Let us know how it goes.


Regards,
Drazen