FileType Property  
 

Gets and sets the current file transfer type.

Syntax

object.FileType [= filetype ]

Remarks

The FileType property specifies the type of file transfer between the local and server. The file transfer types supported are:

Value Constant Description
0 ftpFileTypeAuto The file type should be automatically determined based on the file name extension. If the file extension is unknown, the file type should be determined based on the contents of the file. The control has an internal list of common text file extensions, and additional file extensions can be registered using the AddFileType method.
1 ftpFileTypeText 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.
2 ftpFileTypeEBCDIC 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.
3 ftpFileTypeBinary 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.
4 ftpFileTypeLocal The file is a binary file that uses the local byte size for the server platform. On most servers, this file type is considered to be the same as ftpFileTypeBinary. 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 type should be set before a file is opened or created on the server. Once the file type is set, it is in effect for all files that are subsequently opened or created. Some methods, such as OpenDirectory, will temporarily change the default file type to ftpFileTypeText and then restore the current file type when they return.

Changing the value of this property has no practical effect when connected to an SFTP (SSH) server. They do not differentiate between text and binary files and the default file type will always be ftpFileTypeBinary. If your application is uploading or downloading a text file, this difference between FTP and SFTP is important because the operating system that hosts the server may have different end-of-line character conventions than the client system. For example, if you download a text file from a UNIX system using SFTP, the end-of-line is indicated by a single linefeed (LF) character. However, on the Windows platform, the end-of-line is indicated by a carriage-return and linefeed sequence (CRLF).

Data Type

Integer (Int32)

See Also

AddFileType Method, GetData Method, GetFile Method, PutData Method, PutFile Method