Hola de nuevo.
Para no dejar a medias la idea y tomando el código que te puso el amigo
newtron, podrías hacer algo como:
Código Delphi
[-]
function ExtractFtpPath(const aName: string): string;
var
i,u: Integer;
begin
if aName > '' then
begin
u := 0;
for i := 1 to Length(aName) do
if aName[i] = '/' then u := i;
Result:= Copy(aName, 1, u);
end;
end;
function ExtractFtpFileName(const aName: string): string;
var
i: Integer;
begin
if aName > '' then
begin
i := Length(aName);
while ((aName[i] <> '/') and (i > 0)) do Dec(i);
Result := Copy(aName, i+1, MaxInt);
end;
end;
procedure TForm1.SendFileToFTP(const HostName, UserName, Password,
Origen, Destino: string);
begin
IdFTP1.Host := HostName;
IdFTP1.UserName := UserName;
IdFTP1.Password := Password;
try
IdFTP1.Connect;
except
MessageBox(Handle,'Error al tratar de conectarse','',MB_ICONERROR + MB_OK);
Exit;
end;
IDFTP1.TransferType := ftBinary;
IDFTP1.ChangeDir(ExtractFtpPath(Destino));
try
IDFTP1.Put(ExtractFilePath(Origen), ExtractFtpFileName(Destino));
except
MessageBox(Handle,'Error al enviar el archivo','',MB_ICONERROR + MB_OK);
end;
end;
Llamada de ejemplo:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
begin
SendFileToFTP('HostName', 'JuanPerez', '1234', EditOrigen.Text, EditDestino.Text);
end;
Saludos.
Edito: Tendrás que hacerle las pruebas definitivas sobre el servidor, sólo controlé el resultado de las cadenas.