全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1151
推到 Plurk!
推到 Facebook!

ICS中的FTP SERVER如何设定工作目录及用户帐号?

尚未結案
xmxth001
一般會員


發表:5
回覆:3
積分:1
註冊:2004-05-06

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-05-08 00:15:08 IP:220.160.xxx.xxx 未訂閱
ICS中的FTP SERVER可以制作一个简单的FTP server(重要的是可以集成到系统中),但不知如何设定FTP的工作目录及设定帐号?(演示中无此说明)
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-05-08 01:07:48 IP:218.163.xxx.xxx 未訂閱
{ This event handler is called when the FTP component needs to build a      }
{ directory listing. You can just return without doing anything then the    }
{ component will build the directory for you, based on the actual disk      }
{ content. But you can also build your own directory listing with anything  }
{ you like in it. Just create a stream with the required content. The       }
{ example below construct a virtual directory when the user is on the       }
{ C:\VIRTUAL subdirectory (use elsewhere in this sample program).           }
procedure TFtpServerForm.FtpServer1BuildDirectory(
    Sender        : TObject;
    Client        : TFtpCtrlSocket;
    var Directory : TFtpString;
    Detailed      : Boolean);
var
    Buf : String;
begin
    if UpperCase(Client.Directory) <> 'C:\VIRTUAL\' then
        Exit;
    InfoMemo.Lines.Add('! VIRTUAL DIR');
    Client.UserData   := 1;        { Remember we created a stream }
    if Assigned(Client.DataStream) then
        Client.DataStream.Destroy; { Prevent memory leaks         }
    Client.DataStream := TMemoryStream.Create;
    if Detailed then
        { We need to format directory lines according to the Unix standard }
        Buf :=
      '-rwxrwxrwx   1 ftp      ftp            0 Apr 30 19:00 FORBIDEN'   #13#10  
      '-rwxrwxrwx   1 ftp      ftp            0 Apr 30 19:00 TEST'   #13#10  
      'drwxrwxrwx   1 ftp      ftp            0 Apr 30 19:00 SOME DIR'   #13#10
    else
        Buf := 'FORBIDEN'   #13#10  
               'TEST'   #13#10;
    Client.DataStream.Write(Buf[1], Length(Buf));
    Client.DataStream.Seek(0, 0);
end; 
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-05-08 01:08:44 IP:218.163.xxx.xxx 未訂閱
 procedure TFtpServerForm.FtpServer1Authenticate(Sender: TObject;
  Client: TFtpCtrlSocket; UserName, Password: TFtpString;
  var Authenticated: Boolean);
begin
    { You should place here the code needed to authenticate the user. }
    { For example a text file with all permitted username/password.   }
    { If the user can't be authenticated, just set Authenticated to   }
    { false before returning.                                         }
    { It is also the right place to setup Client.HomeDir              }
    { If you need to store info about the client for later processing }
    { you can use Client.UserData to store a pointer to an object or  }
    { a record with the needed info.                                  }
    InfoMemo.Lines.Add('! '   Client.GetPeerAddr  
                       ' User '''   UserName   ''' is authenticated');
    if Password = 'bad' then
        Authenticated := FALSE;
end;
xmxth001
一般會員


發表:5
回覆:3
積分:1
註冊:2004-05-06

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-05-08 22:40:51 IP:220.160.xxx.xxx 未訂閱
This code is only for client response to change current FTP working directory. But How to set default working dir when FTP server is starting? As My testing the default dir is c:\ or c:\temp before client change directory. The 2nd code is OK for user authorization! Thanks.
robert1014
初階會員


發表:34
回覆:85
積分:43
註冊:2002-03-13

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-05-25 11:38:47 IP:61.222.xxx.xxx 未訂閱
若要設default directory,是可以在 Authenticate 裡 將 anonymous 登入的使用者,指向某個目錄,而其他 帳號登入的使用者,則指向各自的目錄,語法如下 if LowerCase(UserName)='anonymous' then Client.HomeDir:='c:\Temp'; 參考看看!!
xmxth001
一般會員


發表:5
回覆:3
積分:1
註冊:2004-05-06

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-05-26 17:13:28 IP:220.160.xxx.xxx 未訂閱
Good idea! I will test it.Thanks.
Ktop_Robot
站務副站長


發表:0
回覆:3511
積分:0
註冊:2007-04-17

發送簡訊給我
#7 引用回覆 回覆 發表時間:2007-04-26 13:51:48 IP:000.000.xxx.xxx 未訂閱
提問者您好:


以上回應是否已得到滿意的答覆?


若已得到滿意的答覆,請在一週內結案,否則請在一週內回覆還有什麼未盡事宜,不然,
將由版主(尚無版主之區域將由副站長或站長)自由心證,選擇較合適之解答予以結案處理,
被選上之答題者同樣會有加分獎勵同時發問者將受到扣 1 分的處分。不便之處,請見諒。


有問有答有結案,才能有良性的互動,良好的討論環境需要大家共同維護,感謝您的配合。

------
我是機器人,我不接受簡訊.
系統時間:2024-07-04 8:32:18
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!