Copy a file from the remote system to the local system.
Syntax
object.GetFile(LocalFile [,
RemoteFile] [,Offset])
The object placeholder represents an expression that evaluates
to a FileTransfer object.
Return Type
Integer
Remarks
The GetFile method copies an existing file from the
remote system to the local system. If the local file already
exists, it is overwritten.
- LocalFile
- A string that specifies the name of the file that will be
created on the local system. The file pathing and name conventions
must be that of the local host.
- RemoteFile
- A string that specifies specifies the name of the file on the
remote system. You must have permission to open this file for
reading. This is an optional argument; if it is omitted, the value
of the Resource property will be used. It is also
permissible to specify a complete URL and the file will be
downloaded from that location.
- Offset
- An optional integer argument that specifies the byte offset
where the file transfer will begin. This argument is only valid for
FTP servers, and is used to resume interrupted transfers.
Note that not all FTP servers honor the request to restart a
file transfer. Notably, a Windows IIS server will return an error
if a non-zero restart offset is specified. It is not recommended
that you restart text file transfers since differences between
end-of-line characters can result in byte offset differences
between the local and remote host system.
If the AppendFile property is true, then the
RemoteFile will be appended to the LocalFile, if it
exists. Otherwise, the RemoteFile will overwrite the
LocalFile, if it exists.
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.
Example
nError = FileTransfer1.GetFile(strLocalFile, strRemoteFile)
If nError > 0 Then
MsgBox FileTransfer1.LastErrorString, vbExclamation
Exit Sub
End If
See Also
AppendFile Property,
URL Property, GetMultipleFiles Method, PostFile Method, PutFile
Method
|