AddFileType Method  

Associate a file name extension with a specific file type.


object.AddFileType( FileExtension, FileType )


A string that specifies the file name extension.
Specifies the type of file associated with the file extension. This parameter can be one of the following values:
Value Constant Description
1 ftpFileTypeASCII 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.
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 ftpFileTypeImage 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.

Return Value

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 AddFileType method is used to associate specific file types with file name extensions. The control has an internal list of standard text file extensions which it automatically recognizes. This method can be used to extend or modify that list for the client session.

See Also

FileType Property, GetFile Method, GetFileType Method, PutFile Method