zqw0117,我用的是D7自带的INDY9,我采用多线程,只是为了让界面可能不死掉...
文件不算大,所以也没有必要文件分段上传,以下是部分代码;;
//TMyThreadUp用来给处理IDFTP...
MyThreadUp:=TMyThreadUp.Create(True);
MyThreadUp.Path:=lsPath;
MyThreadUp.Host:=Trim(EdtHost.Text);
MyThreadUp.Port:=Trim(EdtPort.Text);
MyThreadUp.User:=Trim(EdtUser.Text);
MyThreadUp.Password:=Trim(EdtPassword.Text);
MyThreadUp.UpPath:=Trim(edtUpPath.Text);
MyThreadUp.Resume;
while True do
begin
Application.HandleMessage;
liBetween:=MySecondsBetween(MyThreadUp.ExecTime,Now);
if (MyThreadUp.ExecResult=ERWait)and(liBetween>=20) then
begin
SBState.Panels[1].Text:='1.文件'+lsNum+'连接超时!';
Break;
end;
if MyThreadUp.ExecResult=ERUnConnect then
begin
if Assigned(MyThreadUp) then freeandnil(MyThreadUp);
SBState.Panels[1].Text:='1.文件'+lsNum+'连接失败!';
Break;
end;
if MyThreadUp.ExecResult=ERSucceed then
begin
SBState.Panels[1].Text:='1.文件'+lsNum+'传输成功!';
Break;
end;
if MyThreadUp.ExecResult=ERFailure then
begin
SBState.Panels[1].Text:='1.文件'+lsNum+'传输失败!';Break;
end;
end;