Click here to Skip to main content
15,065,044 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on a program that send a created text file to an ftp server.
I programmatically wrote the text file and sent the into a checklist on another form.
I added a button on that checklist to send the checked text files to the ftp server.

Feel free to ask about any part of the code so I can give you what you need.

What I have tried:

private void button1_Click(object sender, EventArgs e)

            using (WebClient client = new WebClient())
                client.Credentials = new NetworkCredential(ftpUsername, ftpPassword);
                client.UploadFile("", "STOR", localFilePath);

            MessageBox.Show("sent textfile");

FtpClient client = new FtpClient("server");

            client.Credentials = new NetworkCredential("id", "password");


If there's a better way to send the files to the ftp server I'm ok with it. I'm using FluentFTP.
Updated 11-Aug-17 4:04am

1 solution

GitHub - FluentFTP[^] is an excellent choice. Well maintained, lots of clear examples of how to use with the link[^]. The code that you need is in the first example he gives...
Member 13356973 11-Aug-17 10:27am
On that site you gave me it says this about the upload:
client.UploadFile(@"C:\MyVideo.mp4", "/htdocs/big.txt");

What is the
Graeme_Grant 11-Aug-17 10:33am
I don't see:

on that page. client.UploadFile, according to the documentation, requires a local file and a remote destination path/file. Hence:
client.UploadFile(@"C:\MyVideo.mp4", "/htdocs/big.txt");
example or
// upload a file and retry 3 times before giving up
client.RetryAttempts = 3;
client.UploadFile(@"C:\MyVideo.mp4", "/htdocs/big.txt", FtpExists.Overwrite, false, FtpVerify.Retry);

What exactly are you asking?
Member 13356973 11-Aug-17 10:40am
I mean what mean that part after the coma
client.UploadFile(@"C:\MyVideo.mp4", "/htdocs/big.txt");

the "/htdocs/big.txt"
Graeme_Grant 11-Aug-17 10:48am
Quote: "according to the documentation, requires a local file and a remote destination path/file." ... pretty straight forward...
Member 13356973 11-Aug-17 10:53am
its just the path right?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900