DEV Community

k@k
k@k

Posted on

How to upload file in FTP/SFTP using C#/.Net?

Can you please any one help me........

Top comments (1)

Collapse
 
andreasjakof profile image
Andreas Jakof • Edited

Very boiled down:
For FTP you make a TCP Connection to the Server on Port 21.
Use the FTP-Commands to create the data channel. Open another TCP Connection to the returned port and copy the file‘s bytes to the stream.

SFTP uses SSH as transport layer instead of raw TCP Sockets, open the connection per SSH using one of the few SSH Nuget Packages.

Alternatively you could use a NuGet Package for a FTP Client.