Function Reference


Initiates access to a remote file on an FTP server for reading or writing

#include <FTPEx.au3>
_FTP_FileOpen ( $hConnect, $sFileName [, $iAccess = $GENERIC_READ [, $iFlags = $INTERNET_FLAG_TRANSFER_BINARY [, $iContext = 0]]] )


$hConnect as returned by _FTP_Connect().
$sFileName String of the ftp file to open.
$iAccess [optional] The Local attribute (default $GENERIC_READ).
$iFlags [optional] Specify the conditions under which the transfers occur. The application should select one transfer type and any of the flags that indicate how the caching of the file will be controlled.

The transfer type can be one of the following values:
    $FTP_TRANSFER_TYPE_ASCII (1) - Transfers the file using FTP's ASCII (Type A) transfer method. Control and formatting information is converted to local equivalents.
    $FTP_TRANSFER_TYPE_BINARY (2) - Transfers the file using FTP's Image (Type I) transfer method. The file is transferred exactly as it exists with no changes. This is the default transfer method.
    $INTERNET_FLAG_TRANSFER_ASCII (1) - Transfers the file as ASCII.
    $INTERNET_FLAG_TRANSFER_BINARY (2) - Transfers the file as binary.

The following values are used to control the caching of the file. The application can use one or more of these values:
    $INTERNET_FLAG_HYPERLINK (0x00000400) - Forces a reload if there was no Expires time and no LastModified time returned from the server when determining whether to reload the item from the network.
    $INTERNET_FLAG_NEED_FILE (0x00000010) - Causes a temporary file to be created if the file cannot be cached.
    $INTERNET_FLAG_RELOAD (0x80000000) - Forces a download of the requested file, object, or directory listing from the origin server, not from the cache.
    $INTERNET_FLAG_RESYNCHRONIZE (0x00000800) - Reloads HTTP resources if the resource has been modified since the last time it was downloaded. All FTP and Gopher resources are reloaded.
$iContext [optional] A variable that contains the application-defined value that associates this search with any application data.
This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: the handle to ftp file for read/write with _FTP_FileRead().
Failure: 0 and sets the @error flag to non-zero.


_FTP_FileClose, _FTP_FileGet, _FTP_FilePut, _FTP_FileRead, _FTP_SetStatusCallback

See Also

Search FtpOpenFile in MSDN Library.