I have this code that works perfectly on Windows, but when running the application on Android, the connection to FTP is successful, but when writing the file, the app stays paused without doing anything.
It should be noted that on the FTP server, it appears that I am loading the file as in the image:
This is my code:
procedure TForm1.Button1Click(Sender: TObject);
begin
// testClever;
// exit;
IdFTP:=TIdFTP.Create(nil);
IdSSLIO:=TIdSSLIOHandlerSocketOpenSSL.Create(nil);
IdFTP.Disconnect();
{$ifdef mswindows}
idopensslsetlibpath('C:\Users\karol.campos\Desktop\FTPSExample\SSL');
{$endif}
{$ifdef android}
idopensslsetlibpath(TPath.GetDocumentsPath);
{$endif}
IdSSLIO.SSLOptions.Method:=TIdSSLVersion.sslvSSLv23;
IdSSLIO.PassThrough:=true;
IdFTP.IOHandler:=IdSSLIO;
IdFTP.ListenTimeout:=0;
IdFTP.ReadTimeout:=0;
IdFTP.TransferTimeout:=0;
IdFTP.Passive:=true;
IdFTP.UseTLS:=TIdUseTLS.utUseExplicitTLS;
IdFTP.DataPortProtection:=TIdFTPDataPortSecurity.ftpdpsPrivate;
IdFTP.Host := '(ip_ftp)';
IdFTP.Username := '(user)';
IdFTP.Password := '(pass)';
try
IdFTP.Connect;
try
{$ifdef mswindows}
IdFTP.Put('D:\SeLogro.txt','SeLogro.txt',false);
{$endif}
{$ifdef android}
IdFTP.Put('storage/emulated/0/SeLogro.txt','SeLogro.txt',false);
{$endif}
ShowMessage('Ready!');
finally
IdFTP.Disconnect();
end;
except
on E : Exception do
begin
ShowMessage('Exception class name = '+E.ClassName);
ShowMessage('Exception message = '+E.Message);
end;
end;
end;
I found a similar question, but the code is in Java, will it be possible to do it in Delphi 10.3?