using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Net;
namespace SteamSSFN
{
class Program
{
static void Main()
{
ftpfile("/file.txt", "C:\\file.txt");
}
public static void ftpfile(string ftpfilepath, string inputfilepath)
{
string ftphost = "ip:port";
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();
}
}
}