Topic Path: Symbol Reference > Classes > TIdMimeTable Class > TIdMimeTable Methods > AddMimeType Method
TIdMimeTable.AddMimeType Method

Adds a file extension to MIME type and subtype mapping.

procedure AddMimeType(
    const Ext: string; 
    const MIMEType: string
File extensions for the MIME type and subtype.
IANA MIME type and subtype for the mapping. 

AddMimeType is a procedure that allows adding the new file name extension specified in Ext and the MIME type specified in MIMEType to the mappings in the TIdMimeTable instance. AddMimeType will raise an EIdException exception if the file extension in Ext already exists in the MIME type mapping. 

Ext is the case-insensitive file extension including the '.' character. If the period character is not included in Ext, it will be inserted prior to inclusion in the list of file extensions. If Ext is an empty string (''), an EIdException will be raised with the message RSMIMEExtensionEmpty

MIMEType is the case-insensitive IANA registered MIME type and subtype to be associated with the file extension in Ext. If MIMEType contains an empty string (''), and EIdException will be raised with the message RSMIMEMIMETypeEmpty

Use GetFileMIMEType to get a MIME type for a specified file name and extension. Use GetDefaultFileExt to find the initial file extension found for a given MIME type and subtype. The MIME type mapping table can be loaded with custom values using LoadFromStrings.

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