:GetFileContentType()


Class

     aprMIME()

 

Syntax

     :GetFileContentType( cFilename, [hMessage] ) -> cContentType

 

Parameters

 

cFilename

File name to check Content Type for.

 

hMessage

Optional. Handle of the message to act on. Provided during :CreateMessage() operation

 

Return

cContentType (see Description below)

If an error occurs, cContentType will be empty.

To get more information about the error, see :nErr and :cErr.

 

Description

The content type for a given file is determined based on the file name extension, or if the extension is not recognized, the actual contents of the file. On 32-bit platforms, the system registry is used to determine the default content type values for a given extension. In all cases, file types that are explicitly set using the :SetFileContentType() method will override the default system values.

 

The content type string which is returned is the standard MIME content type description, which specifies a primary type and a subtype, separated by a slash. For example, a plain text file would have a content type of text/plain, while an HTML document would have a content type of text/html. Binary files may be associated with a specific application. For example, the content type for a Microsoft Word document is application/msword. Those binary files which are not associated with a specific application, or have an unrecognized file name extension, have a content type of application/octet-stream.

 

If an error occurs, the Content Type returned will be an empty string ("").

To get more information about the error, see :nErr and :cErr.

  

See Also

:AttachFileEx(), :SetFileContentType()