Open an existing file or creates a new file on the server.
[FileMode], [Offset] )
- A string that specifies the name of the file on the server. The
filename cannot contain any wildcard characters and must follow the
naming conventions of the operating system the server is hosted
- A numeric value which specifies how the file will be accessed.
It may be one of the following values:
|The file is opened for reading on the server. A data
channel is created and the contents of the file are returned to
|The file is opened for writing on the server. If the
file does not exist, it will be created. If it does exist, it
will be overwritten.
|The file is opened for writing on the server. All
data will be appended to the end of the file.
- An optional byte offset which specifies where the file transfer
should begin. If this argument is omitted, this 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. Note that specifying a non-zero offset
using FTP requires that the server support the REST command to
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 OpenFile method opens an existing file or creates a
file on the server using the specified file name. The
Read method may then be used to read data from the file and
the Write method may be used to write data to the file. Once
the all of the data has been read or written, the CloseFile
method must be called to close the data channel.
Only one file may be opened at a time for each client session.
Attempting to perform an action such as uploading or downloading
another file while a file is currently open will result in an error.
Typically this indicates that the application failed to call the
It is strongly recommended that most applications use the
GetFile or PutFile methods to perform file transfers.
These methods are easier to use, and have internal optimizations that
improves the overall data transfer rate when compared to implementing
the file transfer code in your own application.
GetFile Method, PutFile
Method, Read Method,