FluentFTP is a fully managed FTP and FTPS client library for .NET & .NET Standard, optimized for speed. It provides extensive FTP commands, File uploads/downloads, SSL/TLS connections, Automatic directory listing parsing, File hashing/checksums, File permissions/CHMOD, FTP proxies, FXP transfers, UTF-8 support, Async/await support, Powershell support and more.
It is written entirely in C#, with no external dependency. It has an extensive automated test suite which tests all its functionality against local FTP server docker containers.
FluentFTP is released under the permissive MIT License, so it can be used in both proprietary and free/open source applications.
private void FtpClient_ValidateCertificate(FluentFTP.Client.BaseClient.BaseFtpClient control, FtpSslValidationEventArgs e)
{
string CertificationPath = _env.WebRootPath + "\\file.cer";
X509Certificate storedCert = X509Certificate.CreateFromCertFile(CertificationPath);
string localHash = storedCert.GetCertHashString();
if (localHash == null) { e.Accept = false; }
if (e.PolicyErrors == SslPolicyErrors.None || (e.Certificate != null && e.Certificate.GetCertHashString().Equals(localHash)))
{
e.Accept = true;
}
}
public void SecureFTPUploadFile(string host, int port, string username, string password, string source, string destination)
{
FileInfo f = new FileInfo(source);
string uploadfile = f.FullName;
var _ftpClient = new FtpClient(host, username, password, port);
//_ftpClient.Config.CustomStream = typeof(GnuTlsStream);
_ftpClient.Config.EncryptionMode = FtpEncryptionMode.Explicit;
//_ftpClient.Config.ValidateAnyCertificate = true;
_ftpClient.ValidateCertificate += FtpClient_ValidateCertificate;
//_ftpClient.Logger = new FtpLogAdapter(_logger);
......connect......
......upload files...
}
- Full support for FTP, FXP, FTPS, FTPS with TLS 1.3, FTPS with client certificates and FTPS Proxies
- Full support for over 30 FTP server types with integration tests for all major servers
- File management:
- File and directory listing for all major server types (Unix, Windows/IIS, Azure, Pure-FTPd, ProFTPD, Vax, VMS, OpenVMS, Tandem, HP NonStop Guardian, IBM z/OS and OS/400, Windows CE, Serv-U, etc)
- Fully recursive directory listing and directory deletion (manual recursion and server-side recursion)
- Easily upload and download a file from the server with progress tracking
- Easily upload and download a directory from the server with easy synchronization modes
- Easily transfer a file or folder directly from one server to another using the FXP protocol
- Conditionally transfer files using rule based whitelisting and blacklisting
- Automatically verify the hash of a file & retry transfer if hash mismatches
- Configurable error handling (ignore/abort/throw) for multi-file transfers
- Easily read and write file data from the server using standard streams
- Create, append, read, write, rename, move and delete files and folders
- Recursively deletes folders and all its contents
- Get file/folder info (exists, size, security flags, modified date/time)
- Get and set file permissions (owner, group, other)
- Absolute or relative paths (relative to the "working directory")
- Compare a local file against a remote file using the hash/checksum (MD5, CRC32, SHA-1, SHA-256, SHA-512)
- Dereference of symbolic links to calculate the linked file/folder
- Throttling of uploads and downloads with configurable speed limit
- FTP protocol:
- Automatic FTP/FTPS connection negotiation and detection of working connection settings
- Automatic detection of the FTP server software and its capabilities
- Automatic reconnection of FTP connections for broken or degraded sockets
- Extensive support for FTP commands, including some server-specific commands
- Easily send server-specific FTP commands using the
Execute()
method - Explicit and Implicit SSL connections are supported for the control and data connections using .NET's
SslStream
- Passive and active data connections (PASV, EPSV, PORT and EPRT)
- Supports Unix CHMOD, PRET, ProFTPD's SITE MKDIR and RMDIR commands, Serv-U's RMDA command
- Supports Realm and directory navigation for IBM z/OS and OS/400
- Supports all types of FTP Proxies (HTTP 1.1, SOCKS4, SOCKS4a, SOCKS5, User@Host, BlueCoat)
- FTP command logging using
TraceListeners
(passwords omitted) to trace or log output to a file - SFTP is not supported as it is FTP over SSH, a completely different protocol (use SSH.NET for that)
- Asynchronous support:
- Synchronous and asynchronous methods using
async
/await
for all operations - Asynchronous support for the
IAsyncEnumerable
pattern forGetListing
methods (seeGetListingAsyncEnumerable
) - All asynchronous methods can be cancelled midway by passing a
CancellationToken
- All asynchronous methods honor the
ReadTimeout
and automatically cancel themselves if timed out - Asynchronous support for progress tracking of file transfers during data upload/download
- Implements its own internal locking in an effort to keep transactions synchronized
- Synchronous and asynchronous methods using
- Extensible:
- Easily add custom logging/tracing functionality using industry-standard
ILogger
interface - Easily add support for custom non-standard FTP servers (see the Custom Servers page)
- Easily add support for more file or directory filtering rules (simply extend
FtpRule
) - Easily add support for more proxy types (simply extend
FtpClientProxy
) - Easily add unsupported directory listing parsers (see the
CustomParser
example) - Easily add your own Powershell commands by extending the scripts in
FluentFTP.ps1
- Easily add custom logging/tracing functionality using industry-standard
Stable binaries are released on NuGet, and contain everything you need to use FTP/FTPS in your .Net/CLR application.
Package | Latest Version | Downloads | Docs |
---|---|---|---|
FluentFTP | FluentFTP Docs | ||
FluentFTP.Logging | Logging Docs | ||
FluentFTP.GnuTLS | GnuTLS Docs |
For usage see the Quick Start Example and the Documentation wiki.
For features and fixes per release see Release Notes.
FluentFTP is a client library that can connect to these FTP servers and perform all FTP operations.
Server | FTP/FTPS | Integration Tests | Special Features |
---|---|---|---|
Azure FTP | ️ | ✔️ Detected by Domain, Auto Configuration | |
Apache FTP | ️ | ️ | |
ABB IDAL | ️ | ||
BFTPd | ️ | ||
Cerberus | ️ | ||
CrushFTP | ️ | ||
FileZilla Server | ️ | ||
FritzBox | ️ | ||
FTP2S3 Gateway | ️ | ||
glFTPd | ️ | ||
GlobalScape EFT | ️ | ||
Homegate FTP | ️ | ||
Huawei HG5xxx | ️ | ||
HP NonStop/Tandem | ️ | ✔️ NonStop File Listing | |
IBM z/OS | ️ | ✔️ zOS API, File Listing, File Size, Paths | |
MikroTik RouterOS | ️ | ||
OpenVMS | ️ | ✔️ VMS File Listing, Paths, Capability Assumption | |
ProFTPD | ️ | ✔️ SITE RMDIR and SITE MKDIR Commands |
|
PureFTPd | ️ | ||
PyFtpdLib | ️ | ||
Rumpus | ️ | ||
Serv-U | ️ | ✔️ RMDA Command |
|
Solaris FTP | ️ | ||
Titan FTP | ️ | ||
TP-LINK | ️ | ||
VsFTPd | ️ | ||
Windows CE | ️ | ✔️ Windows File Listing | |
Windows Server/IIS | ️ | ✔️ Windows File Listing | |
WS_FTP | ️ | ||
WuFTPd | ️ | ✔️ Capability Assumption | |
XLight | ️ |
FluentFTP works on .NET and .NET Standard/.NET Core.
Platform | Binaries Folder |
---|---|
.NET 4.6.2 | net462 |
.NET 4.7.2 | net472 |
.NET 5.0 | net50 |
.NET 6.0 | net60 |
.NET Standard 2.0 | netstandard2.0 |
.NET Standard 2.1 | netstandard2.1 |
FluentFTP is also supported on these platforms: (via .NET Standard)
- Mono 4.6
- Xamarin.iOS 10.0
- Xamarin.Android 10.0
- Universal Windows Platform 10.0
Binaries for all platforms are built from a single Visual Studio Project. You will need the latset Visual Studio to build or contribute to FluentFTP.
To get started, check out the Quick start example in C#.
We also have extensive examples for all methods in C# and VB.NET.
Check the Wiki.
We have an extensive automated test suite that tests FluentFTP against many servers. We use docker to orchestrate containerized FTP servers that are used for testing.
If FluentFTP helped you or your organization, consider sponsoring the project by donating a small amount per month. Even $20 goes a long way! Everything I receive goes into household expenses and paying the bills.
I have been a freelancer for more than a decade, and your contributions go towards supporting my work and my family. I only recently started asking for donations to fund the time I spend on these open source projects.
Special thanks to these awesome people who helped create FluentFTP!
Any security vulnerabilities that are found can be reported to the project owner at r o b i n r o d r i c k s at g m a i l
. No other direct correspondence will be entertained.
FluentFTP has received free software from these generous organizations:
JetBrains provides cutting-edge IDE and developer productivity tools. | Balsamiq provides rapid and effective wireframing and UI design tools. | YourKit provides a market-leading intelligent Java Profiler and .NET Profiler. |