Set filename on upload

0 votes
asked Apr 19 by Almis (220 points)


I'm trying to upload a file but I want to upload it using a different target name, the reason I want to use a different name is that there is a file system listener that automatically pickups files with a specific extension. I was using FluentFtp, then switch to and now I'm trying this library. Both previous libraries supported this functionality but from what I see you only allow setting directory path. Is there any way to achieve what I want?


Applies to: Rebex SFTP

1 Answer

+1 vote
answered Apr 20 by Lukas Pokorny (126,870 points)
selected Apr 20 by Almis
Best answer

Hello, the PutFile method makes it possible to specify the target name:

// connect to a server
var sftp = new Rebex.Net.Sftp();

// verify server's fingerprint here

// authenticate
sftp.Login(username, password);

// upload a local file to server
sftp.PutFile(@"C:\MyData\file.txt", "/MyData/file.txt");