PutText Method  

Submit the contents of a string buffer to the server.


object.PutText( RemoteFile, Buffer )


A string that specifies the name of a file on the server that will be downloaded. The file pathing and name conventions must be that of the server.
A string which contains the text to be stored on the server. This method will not accept a Byte array as an argument.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.


The PutText method is used to submit the contents of a string to the server using the PUT command. Although a String variable may contain binary data, this method should only be used with strings which contain printable text. Always use the PutData method if you wish to submit binary data, using a Byte array instead of a String variable.

 Not all servers will accept data submitted using this method, and some may require that specific configuration changes be made to the server in order to support the PUT command. Consult your server's technical reference documentation to see if it supports the PUT command, and if so, what must be done to enable it. It may be required that the client authenticate itself by setting the UserName and Password properties prior to uploading the data

The text submitted to the server is automatically converted from Unicode using the code page specified by the CodePage property. By default, text will be automatically converted to use UTF-8 encoding, however you can change this if you prefer to send the data using a different localized encoding. In most cases it is recommended you use UTF-8 to ensure the broadest compatibility with other applications.

This method will cause the current thread to block until the file transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

See Also

CodePage Property, FileType Property, GetData Method, GetText Method, PutData Method, OnProgress Event