Skip to main content
Table of Contents

TTMSFNCUtils.GetMimeType Method

Returns the MIME type associated with a file name or extension.

API unit family: TMSFNCUtils Declaring type: TTMSFNCUtils

Overloads

Overload 1

Returns the MIME type associated with a file name or extension.

FMX.TMSFNCUtils.hppPascalC++
class function GetMimeType(AFile: string): string; overload;
__classmethod System::UnicodeString __fastcall GetMimeType(System::UnicodeString AFile)/* overload */;

Parameters

Name Description
AFile File name, path, or extension to inspect.

Returns

Matching MIME type, or application/octet-stream when unknown.

Overload 2

Detects the MIME type represented by stream header bytes.

FMX.TMSFNCUtils.hppPascalC++
class function GetMimeType(AData: TStream; AResetPosition: Boolean = True): string; overload;
__classmethod System::UnicodeString __fastcall GetMimeType(System::Classes::TStream* AData, bool AResetPosition = true)/* overload */;

Parameters

Name Description
AData Stream containing file data.
AResetPosition When True, reads from the beginning of the stream; the original position is restored afterward.

Returns

Detected MIME type, or an empty string when no known header is found.