Upload a file from the local system to the server in the background.
This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.
The AsyncPutFile method will upload the contents of a file on the local system to the server. It is similar to the PutFile method, however it retrieves the file using a background worker thread and does not block the current working thread. This enables the application to continue to perform other operations while the file is being uploaded to the server. This method requires that you explicitly establish a connection using the Connect method. All background tasks will duplicate the active connection and use it establish a secondary connection with the server to perform the file transfer. If you wish to perform multiple asynchronous file transfers from different servers, you must create an instance of the control for each server.
After this method is called, the OnTaskBegin event will be fired, indicating that the background task has begun the process of connecting to the server and performing the file transfer. As the file is uploaded, the control will periodically invoke the OnTaskRun event handler. When the transfer has completed, the OnTaskEnd event will be fired. It is not required that you implement handlers for these events.
To determine when a transfer has completed without implementing any event handlers, periodically call the TaskDone method. If you wish to block the current thread and wait for the transfer to complete, call the TaskWait method. To stop a background file transfer that is in progress, call the TaskAbort method. This will signal the background worker thread to cancel the transfer and terminate the session.
This method can be called multiple times to upload more than one file in the background; however, most servers limit the number of simultaneous connections that can originate from a single IP address. The application should not make any assumptions about the sequence in which background transfers are performed or the order in which they may complete.