Delphi 使用Indy idftp 通过Android 上传文件


本文整理自网络,侵删。

 
var
ftp_port,ftp_folder:string;
ftp_error : Boolean;

begin
IdFTP1.ConnectTimeout := 1000;
  IdFTP1.Passive := True;
  IdFTP1.Host    := '';//ftp_server;
  IdFTP1.Username:= '';//ftp_user;
  IdFTP1.Password:= '';//ftp_pass;

  if ftp_port<> '' then begin
    Try
      IdFTP1.Port    := StrToInt(ftp_port);
    except
      IdFTP1.Port := 21;
    End;
 end;


      Try
        ftp_error := False;
        IdFTP1.Connect;
        IdFTP1.Passive := true;
        if ftp_folder= '' then
          IdFTP1.Put( System.IOUtils.TPath.Combine(System.IOUtils.tpath.getdocumentspath,'temp.txt'), ftp_file, False )
        else begin
          if ftp_folder[length(ftp_folder)] <> '/'  then
            ftp_folder:= ftp_folder+ '/';

          IdFTP1.Put( System.IOUtils.TPath.Combine(System.IOUtils.tpath.getdocumentspath,'temp.txt'), ftp_folder+ftp_file, False );
        end;
        IdFTP1.Disconnect;
      except
        ftp_error := True;
      End;


          if not ftp_error then begin

            showmessage('FTP connection correct');
          end
          else begin
            showmessage('Error FTP');
          end;

相关阅读 >>

Delphi 开启内存泄漏报告模式

Delphi返回一个汉字的unicode编码

Delphi 消息实现窗口最小化,最大化,关闭(Delphi)

Delphi net.httpclient正则批量获取网页代码中的数值

Delphi snowflake一秒可生成500万id的分布式自增id算法―雪花算法

Delphi 实现窗体倒计时进度条显示

Delphixe8中获取apk的签名信息

Delphi xe5 实现获取本地的ip地址

Delphi winapi: getclassname - 获取指定窗口的类名

Delphi fastreport 直接列印

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...