Recent

Author Topic: FTPSend. How can I get status about StoreFile function?  (Read 2998 times)

aguila3000

  • New Member
  • *
  • Posts: 12
FTPSend. How can I get status about StoreFile function?
« on: March 26, 2017, 05:16:17 pm »
Hello.

I need help with FtpSend.
How can I get status about StoreFile function?

When I use fttpsend and I try to append text on a Memo(log), The memo doesn't update immediately. It shows all text after Ftpsend has ended or log out. Why? or How can I run log.append function after StoreFile function?.

This code run perfectly, It uploads the files on my web but Log.Append shows all messages when Ftpsend is log out. I want to show messages while it is uploaded each file. How can I do that?

Code: Pascal  [Select][+][-]
  1.   Arch:=TStringList.Create;
  2.  
  3.   //Change carpeta.php file
  4.   Arch.LoadFromFile(RutaWebLocal+'carpetas.php');
  5.   Arch.Strings[1]:='  $WEB="web"; //local o web';
  6.   Arch.SaveToFile(RutaWebLocal+'carpetas.php');
  7.  
  8.   TFTPCliente:=TFTPSend.Create;
  9.   TFTPCliente.TargetHost:='xxx.com';
  10.   TFTPCliente.TargetPort:='21';
  11.   TFTPCliente.UserName:='xxx';
  12.   TFTPCliente.Password:='xxx';
  13.  
  14.   if TFTPCliente.Login then
  15.     Begin
  16.       Log.Append('Entrando');
  17.       TFTPCliente.ChangeWorkingDir('/');
  18.       TFTPCliente.DirectFile:=True;
  19.       for i:=0 to Memo2.Lines.Count-1 do
  20.        begin
  21.  
  22.          //Get file from a list, each line is file in Memo2.
  23.          aux1:=Memo2.Lines.Strings[i];
  24.          delete(aux1,1,pos('/',aux1)-1);
  25.          aux2:=StringReplace(aux1,RutaWebLocal,'',[rfReplaceAll]);
  26.          aux2:=trim(aux2);
  27.        
  28.  
  29.          TFTPCliente.DirectFileName:=aux1;
  30.          TFTPCliente.StoreFile(RutaWeb+aux2,true);
  31.  
  32.          Log.Append('.')
  33.  
  34.        end;
  35.       TFTPCliente.Logout;
  36.       Log.Append('Saliendo');
  37.    end
  38.   else Log.Append('No entro');
  39.   TFTPCliente.Free;        
  40.  

Thaddy

  • Hero Member
  • *****
  • Posts: 14393
  • Sensorship about opinions does not belong here.
Re: FTPSend. How can I get status about StoreFile function?
« Reply #1 on: March 26, 2017, 08:40:31 pm »
In the loop, after Log.Append('.'); do Application.ProcessMessages.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

aguila3000

  • New Member
  • *
  • Posts: 12
Re: FTPSend. How can I get status about StoreFile function?
« Reply #2 on: March 27, 2017, 12:51:03 am »
 :D
Thanks.

 

TinyPortal © 2005-2018