3

I would like to integrate FileZilla with my application written in C#. please someone show me sample code or web site that shows sample code.

although i found article on web, and that article was saying "application is integrated with FileZilla is so slow". but i don't know if i can stand that late or not. so i would like to challenge.

Yamachan
  • 71
  • 1
  • 2
  • 10

4 Answers4

3

To support FTP/SFTP or any other protocol in C# you can do it in 3 ways:

1. NEW APP PROCESS - Start an app that does the FTP communication in separate process, and be able to control what file to download, where to save it and to tell the app to terminate when download is finished. This way, you can use FileZilla only if it lets you pass certain parameters in command line, like the URI of the resource you want to transfer through FTP/SFTP, and the path where the file should be saved to. And as I can see HERE this could work.

To start the process and pass it command line arguments in C# you would do something like this:

static void StartNewProcess(string app, string args)
{
    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.FileName = app;   //full app path
    startInfo.Arguments = args; //command line arguments
    startInfo.CreateNoWindow = true; //dont create app window
    startInfo.WindowStyle = ProcessWindowStyle.Hidden; //hide app from taskbar
    Process.Start(startInfo);
}

Now you can execute FileZila app, pass it args containing file URL and let it do its job... But you cant know how long will it take to download the file, when the download is ended, do you need to log in to get it...

2. EXISTING CLASS LIBRARY - Include a Class Library that is written by someone else, that does the job. This way you are in TOTAL control of the process. And as many other suggested, this would be a perfect way for you. Many answers here contain good class libraries that you can use and be happy with the results.

3. HOME-MADE CLASS LIBRARY - Open RFC 959, read it all and write your code... (Now 2. sounds better, doesn't it? :D)

Cipi
  • 11,055
  • 9
  • 47
  • 60
  • RFC 959 is only for FTP. SFTP (remote file access protocol that runs over SSH) is a different thing and requires implementation of SSH and SFTP, which is quite non-trivial task. – Eugene Mayevski 'Callback Mar 02 '11 at 11:26
  • thanks for reply. your reply is the answer i was really want. i will try it. :) and i will tell my total think to boss. – Yamachan Mar 03 '11 at 03:23
2

Filezilla is a GUI FTP client, you can't use it to "script" SFTP operations (it only accepts a very limited set of command line arguments).

You must seek a third party C# component or write one yourself (not recommended) to do the job.

Albireo
  • 10,977
  • 13
  • 62
  • 96
  • The client command line arguments were exactly what I was looking for. Thanks! (Not sure what the OP wanted - I just wanted a shortcut to launch Filezilla set to a specific site from my program.) – ArtOfWarfare Aug 15 '17 at 18:40
1

I recommend using SharpSSH, if you need to send files via SSH/SFTP in your application.

dhirschl
  • 2,088
  • 13
  • 18
  • Tamir SSH is not a perfect solution http://stackoverflow.com/questions/29219880/upload-failing-to-sftp-server-using-tamir-sharpssh-getting-non-descriptive-erro – PUG Mar 23 '15 at 20:53
0

To support FTP or SFTP from your C# application, you could use an external library like the one from Chilkat http://www.chilkatsoft.com/ftp-2-dotnet.asp. I use it and it works great!

In theory, you could also implement the FTP protocoll using socket connections by yourself, but you should save yourself that trouble -> don't reinvent the wheel...

Tobias Schittkowski
  • 2,221
  • 2
  • 16
  • 25