Uploading files from memory

Top  Previous  Next

You can upload data from memory using any of the Sftp.Upload methods that take a byte array as it's first argument.

 

Example

 

[C#]

 

// specify contents and convert to a byte array

string contents = "this is a test of some data";

byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes(contents);

 

// upload data and store to file testdata.txt

sftp.Upload(data,"testdata.txt");

 

 

[VB]

 

' specify contents and convert to a byte array

Dim contents As String = "this is a test of some data"

 

' upload data and store to file testdata.txt

Dim data As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(contents)

sftp.Upload(data, "testdata.txt")