Back to product page

GetData method


Retrieves contents of remote file to string variable.

Type

None

Syntax

  • Basic
object.GetData [RemoteFile]
The GetData(object,RemoteFile) syntax has these parts:
objectAn expression evaluating to an object of type wodSFTP.
RemoteFileOptional. A Variant value. Full path to file on the server.

Remarks

Unlike the GetFile method, that copies a file from the remote server to a local file, GetData will get a file from the server and copy it to the String variable. Once everything is completed and the Done event has fired (as for all other methods), the ListItem property will hold the retrieved data.

The GetData method will try to create a temporary file on your local disk, so please ensure that wodSFTP has sufficient privileges to do this. In ASP (and other similar environments), wodSFTP usually runs as the Guest user, which may not have sufficient privileges to perform this operation. In this case it will fail with an error (Could not create temporary file).

In ASP we advise that you make the call as follows:

      Sftp1.GetData CStr(RemoteFile)

This will ensure that wodSFTP can read the optional string parameter correctly.

Platforms

Windows