Ver Mensaje Individual
  #6  
Antiguo 24-06-2017
jhonalone jhonalone is offline
Miembro
 
Registrado: sep 2007
Ubicación: Madrid
Posts: 547
Reputación: 17
jhonalone Va por buen camino
Hola a todos.

En contra de la extendida costumbre en este foro de comentar, "gracias a todos, pero ya he resuelto el problema" y no dejar constancia de la solución que se ha utilizado, yo no comulgo con ésa idea y, cuando resuelvo algo, bien o mal, me gusta compartir el resultado, por si puede ser útil a otro visitante que tenga el mismo problema.

Os dejo la solución que me ha funcionado a mí:
Código Delphi [-]

unit Unit4;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
FMX.Controls.Presentation, IdFTP,  IdFTPCommon, FMX.Objects, IOUtils;

type
TForm4 = class(TForm)
       Button1: TButton;
       Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form4: TForm4;

implementation

{$R *.fmx}

procedure TForm4.Button2Click(Sender: TObject);
var
F : TextFile;
sPath :String;
S : String;
begin
    sPath := TPath.Combine(TPath.GetDocumentsPath, 'Prueba.txt');
    AssignFile(F,sPath);
    Reset(F);                                                                             
    ReadLn(F,S);
       ShowMessage(S);
    CloseFile(F);
end;

procedure TForm4.Button1Click(Sender: TObject);
var
filename : String;
idFTP1 : TidFTP;
FS : TMemoryStream;
sPath :String;
begin
   FileName := '/Prueba.txt';
    sPath := TPath.Combine(TPath.GetDocumentsPath, 'Prueba.txt');
    IdFTP1 := TidFTP.Create(Nil);
    IdFTP1.Host := 'ftp.xxxxxx.com';
    IdFTP1.Username := 'xxxxxxxxxxx';
    IdFTP1.Password := 'xxxxxxxxxxxx';
    IdFTP1.Passive := True;
    IdFTP1.ConnectTimeout := 6000;
    Fs := TMemoryStream.Create;
    try
      IdFTP1.Connect;
      try
        IdFTP1.TransferType := ftBinary;
        IdFTP1.Get(FileName, FS);
        FS.Position := 0;
        FS.SaveToFile(sPATH);
      finally
        IdFTP1.Disconnect;
      end;

    finally
      Fs.Free;
    end;
 //if FileExists(sPath) then   ShowMessage('Existe');
 end;
end.

Saludos a todos.
__________________
"Pedid y se os dará; buscad y hallaréis ..." (Lc 11,9-10)
"...si no tengo caridad, nada soy..." (1 Cor 13,1-13)
Responder Con Cita