1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132:
| procedure TForm2.Button17Click(Sender: TObject); var s,quelle,filename,dest,fi:string; a,b,c,i:integer; slist,uploadlist:tstringlist; f: file of Byte; size: Longint; begin label13.Caption:=inttostr(filelistbox1.SelCount);
begin AssignFile(f, filelistbox1.FileName); Reset(f); try size := FileSize(f); finally CloseFile(f);
gauge1.MaxValue:=size; gauge1.MinValue:=0;
end;
uploadlist :=tstringlist.Create; for a :=0 to filelistbox1.Count -1 do begin if filelistbox1.Selected[a] then uploadlist.Add(filelistbox1.items[a]) end; filelistbox3.Items:=uploadlist; for a := 0 to filelistbox1.Count -1 do begin if filelistbox1.Selected[a] then begin quelle:=(FileListBox1.Directory+'\'+FileListBox1.Items[a]); filename:=FileListBox1.Items[a]; FTPKopie:=FTPCOPY.create(true); FTPKopie.quelle:=quelle; FTPKopie.filename:=filename; FTPKopie.resume;
end; end; SList := TStringList.Create; IdFTP1.List(Slist,'*.*',false); Filelistbox2.Items:=SList; filelistbox3.Clear; end; end;
So jetzt der thread
unit Unit4;
interface
uses Classes, StdCtrls, idftp, Forms;
type FTPCOPY = class(TThread) idftp2:Tidftp; Procedure schicken;
private
protected procedure Execute; override;
public quelle,filename:string;
end;
implementation uses unit2,unit1;
procedure FTPCOPY.Execute; begin
idftp2:=Tidftp.Create(nil); idftp2.Host:='192.168.128.119'; idftp2.Username:='mrx'; idftp2.Password:='cyclon';
idftp2.Connect; idftp2.ChangeDir('/f:/ftp/mrx/'); schicken; idftp2.Disconnect; end;
procedure FTPCOPY.schicken ; begin idftp2.Put(quelle,filename, true); end;
end. |