请问各位大虾,怎样用delphi实现将远程服务器上的一个文件下载到本机的指定目录(已知登陆的用户名和密码,不一定要求多线程下载),能有原码和分析最好了,分不够可再加。

解决方案 »

  1.   

    利用FTP控件下载,源码为:
    procedure Tfrm_main.BitBtn4Click(Sender: TObject);
    var
      i: integer;
      spath: string;
      stemp: string;
    begin
        for i := 0 to (listbox1.Items.Count - 1) do
        begin
          spath := listbox1.Items.Strings[i];
          stemp := spath;
          delete(stemp, 1, length(stemp) - 1);
          if (spath = '..') or (stemp = '/') then
            listbox1.Selected[i] := false;
          if listbox1.Selected[i]=true then
          begin
            try
              nmftp1.Download(spath, localdir + spath);
            except
              on E: EXCEPTION do
                showmessage(E.Message);
            end;
            filelistbox1.Update;
          end;
        end;
    end;已经使用的一个下载程序的过程
      

  2.   

    intraweb控件组有download,upload功能