Нашёл
Если кому надо:
| Код | using System.Net; using System.IO;
|
| Код | ... static void Main(string[] args) { ftpfile("/qwerty.txt", "C:\\qwerty.txt"); }
public static void ftpfile(string ftpfilepath, string inputfilepath) { string ftphost = "ftp.host.com";
string ftpfullpath = "ftp://" + ftphost + ftpfilepath; FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath); ftp.Credentials = new NetworkCredential("user", "pass");
ftp.KeepAlive = true; ftp.UseBinary = true; ftp.Proxy = null; ftp.Method = WebRequestMethods.Ftp.UploadFile; FileStream fs = File.OpenRead(inputfilepath); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); fs.Close(); Stream ftpstream = ftp.GetRequestStream(); ftpstream.Write(buffer, 0, buffer.Length); ftpstream.Close(); } ...
|
|