This method is used to determine the file transfer type to be
used when uploading or downloading files. This method is used internally when
ftpFileTypeAuto is specified as the default file type. The return value
may be one of the following:
|The file is a text file using the ASCII character set. For
those servers which mark the end of a line with characters
other than a carriage return and linefeed, it will be converted
to the native client format. This is the file type used for
directory listings. The constant ftpFileTypeText is an
alias for this value.
|The file is a text file using the EBCDIC character set.
Local files will be converted to EBCDIC when sent to the
server. Remote files will be converted to the native ASCII
character set when retrieved from the server. Not all servers
support this file type. It is recommended that you only specify
this type if you know that it is required by the server to
transfer data correctly.
|The file is a binary file and no data conversion of any type
is performed on the file. This is the default file type for most
data files and executable programs. If the type of file cannot be
automatically determined, it will always be considered a binary
file. If this file type is specified when uploading or
downloading text files, the native end-of-line character
sequences will be preserved. The constant ftpFileTypeBinary
is an alias for this value.
If the file extension or contents are not recognized, the default
file transfer type for the client session will be returned. This will
usually be ftpFileTypeImage, however this can be changed by calling the
AddFileType method. The file type for the current
client session can be explicitly set using the FileType
If the ScanFile parameter is True, the local file will
be opened in a shared reading mode and up to 4,096 bytes will be
examined to determine if it contains binary data. If the file is currently
locked or has been opened exclusively by another process, the file
type associated with the file extension will be returned instead.
Text files which contain UTF-16 text will always return a file type
of ftpFileTypeImage because they can contain non-ASCII characters and/or
embedded null characters.
If the ScanFile parameter is True and the file type
cannot be determined based on the file name extension, the file
specified by FileName must exist and be a regular file. If
the file does not exist, an error will be returned and the last error
code will be set to stErrorFileNotFound. If the ScanFile
parameter is False, no errors will be returned if the file does not
exist, the function will only check the file name extension to
determine the file type. When downloading a file, the ScanFile
parameter should normally be zero because the local file may not exist