Last active
August 29, 2015 13:57
-
-
Save FernandoVezzali/9687695 to your computer and use it in GitHub Desktop.
FTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// first install this NuGet package: Install-Package ftplib | |
static void Main(string[] args) | |
{ | |
using (var tConn = new FtpConnection("00.000.00.000", "UserName", "Password")) | |
{ | |
tConn.Open(); | |
tConn.Login(); | |
if (tConn.DirectoryExists("/www")) | |
tConn.SetCurrentDirectory("/www"); | |
try | |
{ | |
tConn.PutFile(@"C:\index.htm"); | |
} | |
catch (FtpException e) | |
{ | |
// Handle exception | |
} | |
tConn.Close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment