forked from robinrodricks/FluentFTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenAppend.cs
31 lines (28 loc) · 1.29 KB
/
OpenAppend.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.IO;
using System.Net;
using FluentFTP;
namespace Examples {
public class OpenAppendExample {
public static void OpenAppend() {
using (FtpClient conn = new FtpClient()) {
conn.Host = "localhost";
conn.Credentials = new NetworkCredential("ftptest", "ftptest");
using (Stream ostream = conn.OpenAppend("/full/or/relative/path/to/file")) {
try {
// be sure to seek your output stream to the appropriate location, i.e., istream.Position
// istream.Position is incremented accordingly to the writes you perform
// istream.Position == file size if the server supports getting the file size
// also note that file size for the same file can vary between ASCII and Binary
// modes and some servers won't even give a file size for ASCII files! It is
// recommended that you stick with Binary and worry about character encodings
// on your end of the connection.
}
finally {
ostream.Close();
}
}
}
}
}
}