PutFile Method  
 

Copy a file from the local system to the server.

Syntax

object.PutFile( LocalFile, RemoteFile, [Options], [Offset] )

Parameters

LocalFile
A string that specifies the file on the local system that will be transferred from the local system. The file pathing and name conventions must be that of the local host.
RemoteFile
A string that specifies the file on the server that will be created or overwritten. The file pathing and name conventions must be that of the server.
Options
An optional numeric value which specifies one or more options. This argument may be any one of the following values:
Value Description
httpTransferDefault This option specifies the default transfer mode should be used. If the local file exists, it will be overwritten with the contents of the remote file. If the Options argument is omitted, this is the transfer mode which will be used.
Offset
An optional byte offset which specifies where the file transfer should begin. The default value of zero specifies that the file transfer should start at the beginning of the file. A value greater than zero is typically used to restart a transfer that has not completed successfully.

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.

Remarks

The PutFile method is used to transfer a file from the local system to a server using the PUT command. Not all servers permit files to be uploaded using this method, and some may require that specific configuration changes be made to the server in order to support this functionality. 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 file.

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

GetData Method, GetFile Method, PostFile Method, PutData Method, OnProgress Event