Text.FileExtensionToMimeType
----------------------------

Finds a mime type for a file extension.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Text](component_Text.md) | [5.4](newinversion54.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Text.FileExtensionToMimeType"; FileExtension ) 

**MBS**( **"Text.FileExtensionToMimeType";** /\* Finds a mime type for a file extension. \*/  
**$FileExtension**) /\* The file extension to lookup. Anything before a dot is ignored, so you can pass whole file name or path.e.g. "test.pdf" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| FileExtension | The file extension to lookup. Anything before a dot is ignored, so you can pass whole file name or path. | "test.pdf" |

### Result

Returns OK or error.

### Description

Finds a mime type for a file extension.  
  
Please report any missing mime type in our lookup table, so we can add more.  
See also [Text.MimeTypeToFileExtension](TextMimeTypeToFileExtension.md).  
### Examples

Find mime type for PDF:

 MBS ("Text.FileExtensionToMimeType"; "pdf")  
<small>  
Example result: application/pdf</small>Find mime type for whole file name:

 MBS ("Text.FileExtensionToMimeType"; "my.test.pdf")  
<small>  
Example result: application/pdf</small>### See also

- [Container.GetMimeType](ContainerGetMimeType.md)
- [CURL.FormAddKeyValueContentType](CURLFormAddKeyValueContentType.md)
- [MailComposer.AddAttachmentContainer](MailComposerAddAttachmentContainer.md)
- [MailComposer.AddAttachmentFile](MailComposerAddAttachmentFile.md)
- [MailComposer.AddAttachmentText](MailComposerAddAttachmentText.md)
- [MessageComposer.AddAttachmentContainer](MessageComposerAddAttachmentContainer.md)
- [MessageComposer.AddAttachmentFile](MessageComposerAddAttachmentFile.md)
- [SendMail.AddAttachmentFile](SendMailAddAttachmentFile.md)
- [SocialRequest.addMultipartContainer](SocialRequestaddMultipartContainer.md)
- [Text.MimeTypeToFileExtension](TextMimeTypeToFileExtension.md)

### Release notes

- **Version 13.5**
    - Fixed error message for [Text.FileExtensionToMimeType](https://www.mbsplugins.eu/TextFileExtensionToMimeType.shtml) function.
- **Version 8.1**
    - Changed [Text.FileExtensionToMimeType](http://www.mbsplugins.eu/TextFileExtensionToMimeType.shtml) to prefer our table in the plugin to not report wrong type if your desktop database on Mac is broken.

### Example Databases

- [CURL/Amazon S3/Containers in S3](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Containers%20in%20S3.shtml#2ScriptAnchor_)
- [iOS/Examples/iOS Email Sending](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/iOS/Examples/iOS%20Email%20Sending.shtml#6ScriptAnchor_)
- [iOS/Examples/iOS Message Sending](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/iOS/Examples/iOS%20Message%20Sending.shtml#6ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 13.5pr6](https://www.mbsplugins.de/archive/2023-10-26/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.1pr2](https://www.mbsplugins.de/archive/2018-02-07/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.4pr1](https://www.mbsplugins.de/archive/2015-10-11/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 2nd October 2015 , last changed 11st December 2016

  
[Text.EncodeURLComponent](TextEncodeURLComponent.md) - [Text.FilterASCII](TextFilterASCII.md)

[HTML Version](TextFileExtensionToMimeType.shtml)