IdFTP: TIdFTP;
...
procedure TForm1.IdFTPWorkEnd(ASender: TObject; AWorkMode: TWorkMode);
begin
IdFTP.Disconnect;
try
IdFTP.Connect;
IdFTP.ChangeDir( directory );
IdFTP.Put( fileName, ExtractFileName( fileName ) );
except
end;
end;
This is most of the code. I wish when the 1 upload complete to start another, but this code seems to rise an error 10048.
Error 10048 = Socket already in use: info
You don't need the WorkEnd event, Put statement returns when its finished with uploading a file:
// loop
for I := 0 to files.Count-1 do
begin
idFtp1.Connect;
idFtp1.Put(files[i]);
idFtp1.Disconnect;
end;
// or
idFtp1.Put('MyFirstFile');
idFtp1.DisConnect;
// ......
idFtp1.Connect;
idFtp1.ChangeDir('DirSecondFile');
idFtp1.Put('MySecondFile');