Topic Path: Symbol Reference > Classes > TIdMimeTable Class
ContentsIndexHome
PreviousUpNext
TIdMimeTable Class

Provides access to MIME types for the local computer.

File
TIdMimeTable = class(TObject);

TIdMimeTable is a class used in Indy to provide access to the known MIME types and file name extensions from settings on the local computer system. TIdMimeTable provides a degree of isolation from the issues related to platform-specific MIME type storage. 

On the Windows platform, TIdMimeTable relies on an initial set of common MIME types supplemented by values harvested from the Windows HKEY_CLASSES_ROOT Registry key. On the Linux platform, there is no universal counterpart to the Windows Registry for MIME types. A text-based configuration file is normally present in most Linux distributions. But it's name and location in the file system hierarchy is different for each family of distribution. Each Desktop/Window manager, and many applications, maintain their own MIME type configuration files. Their names and locations are almost always radically different, too. 

To accommodate developers on both platforms, TIdMimeTable provides methods that can be used to control the location, format, and content of values used for MIME types. The OnBuildCache event handler can be used to override loading of the cached MIME types registered on the local computer. In addition, LoadFromStrings and SaveToStrings can be used to override the values loaded and stored for TIdMimeTable. 

GetFileMIMEType can be used to retrieve the MIME type for a specified file name based on the file extension. GetDefaultFileExt can be used to retrieve the file extension associated with the specified MIME type. Use AddMimeType to add a file extension and MIME type to TIdMimeTable. 

TIdMimeTable is designed primarily for use by client applications. But, TIdMimeTable is also used in TIdCustomHTTPServer to determine the file names and extensions that can be provided for an HTTP request with "Accept" header(s) for specific MIME types.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.