用TNMFTP上传文件

注:TFTP为窗体类名

procedure TFTP.Button1Click(Sender:TObject);

begin

button1.Enabled:=false;

NMFTP1.Host:='www.wh-ccic.com.cn';

NMFTP1.Port :=21;

NMFTP1.TimeOut:=5000;

NMFTP1.UserID :=UserTxt.Text;

NMFTP1.Password :=PassTxt.Text;

try

NMFTP1.Connect;

except

Exit;

end;

NMFTP1.InputFileMode:=False;

NMFTP1.OutputFileMode :=False;

NMFTP1.ReportLevel:=Status_Basic;

end;

procedure TFTP.NMFTP1Connect(Sender:TObject);

begin

StatusBar1.SimpleText:='连接主机!';

TFTP.ChangeDir('admin\cljg\sjkwj');

try

StatusBar1.SimpleText:='正在更新文件......;

FileUpdate();

StatusBar1.SimpleText:='';

Application.ProcessMessage;

sFileName:=ExtractFilepath(Application.ExeName)+'sendtable.txt');

NMFTP1.Upload(sfileName,'sendtable.txt');

except

NMFTP1.Disconnect;

Exit;

end;

NMFTP1.Disconnect;

NMFTP1.Post('http://www.wh-ccic.com.cn/admin/cljg/sjkwj/default.asp','');

end;

原文地址:https://www.cnblogs.com/djcsch2001/p/2035825.html