string msg = "Writing to file.";
byte[] data = System.Text.Encoding.Default.GetBytes(msg);
System.IO.MemoryStream mem = new System.IO.MemoryStream(data);
ftpClient.PutFile(mem,"file.txt");
While I connect with no issue, I've been receiving this exception that I don't quite understand:
An unhandled exception of type 'Rebex.Net.SftpException' occurred in Rebex.Sftp.dll
Additional information: Permission denied; Permission denied."
It says that you do not have permissions for the operation. Probably you do not have permissions to create/write the file.
It can easily be caused by an absence of a path in your PutFile
call. It may try to upload the file to a file system root, where only root
can write.
Try using a full path, like /home/user/file.txt
.