# 工作筆記 #8 - FileZilla Server 設定與壓縮檔上傳 需求 --- > 測試上傳壓縮檔至本地 FTP Server <br /> 前置作業 --- ### 1. 安裝 [FileZilla](https://filezilla-project.org/) Server  <br /> ##### * 安裝時設置密碼。  <br /> ### 2. 安裝 [FileZilla](https://filezilla-project.org/) Client  <br /> ### 3. 開啟 FileZilla Server。 > 路徑:C:\Program Files\FileZilla Server\filezilla-server-gui.exe ##### * 填入安裝時設定的密碼。  ##### * 設定使用者。   <br /> ### 4. 測試連線。 ##### * 開啟 FileZilla Client。(路徑:C:\Program Files\FileZilla FTP Client\filezilla.exe)  ##### * 新增站台  <br /> 程式說明 --- > 上傳檔案至 FTP Server ``` public bool UploadFile() { try { string ftpPath = "ftp://" + "ip(127.0.0.1)" + "/上傳路徑/" + "檔案名稱"; // 要上傳的檔案 StreamReader sourceStream = new StreamReader("檔案路徑"); byte[] data; using (MemoryStream ms = new MemoryStream()) { sourceStream.BaseStream.CopyTo(ms); data = ms.ToArray(); } sourceStream.Close(); WebClient wc = new WebClient(); wc.Credentials = new NetworkCredential("使用者名稱", "密碼"); wc.UploadData(ftpPath, data); return true; } catch (Exception ex) { return false; } } ``` <br /> ###### tags: `FileZilla` `FTP` `.net` --- 參考資料 > https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/740866/
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.