Table of Contents
- About the Project
- Getting Started
- fmapi Product Suite
About The Project
As we delved into the world of REST APIs using FileMaker, we stumbled across an issue.
How do we get a file's MIME-type in FileMaker Pro?
When you are dealing with binary data and having to send HTTP Headers in relation to this data, you will most certainly have to provide a
Content-Type header at some point.
This header tells the recipient the type of information that is being passed over the network.
e.g. A pdf file will have the Content-Type of
We found out during our development of fmapi-aws-s3 that to put data onto an S3 bucket, we would have to pass in the MIME-type of the file we send.
This was an issue and with any issue, solutions are born.
A FileMaker script which when passed a valid filename, will return the correct MIME-type for that file format.
- FileMaker Pro
- No 3rd party plugins.
Backwards Compatible: This script has been designed to be backwards compatibile to FileMaker Pro 12!
Small Code Base: We've optimised our code as much as possible which has resulted in the script being less than 50 script lines.
Extremely Fast: With optimisation comes efficiency. Our testings show that the script runs at less than 500ms on the first run. Subsequent runs after it's cached the mime-db.json run, consistently, at ~50ms. These tests where run on the script locally. Networked usage may differ.
No Dependencies: This script is fully dependent and requires no plugins.
The FileMaker script makes use of the Insert from URL script step introduced in FileMaker 12.
This means that this script will only work with FileMaker 12+ products.
Using the script with anything less than 12 will have unexpected behaviour.
FileMaker Text Parsing Functions
We have built the rules for identifying MIME-types in FileMaker using all the Text Functions available to us and from our testing it has handled all the filenames thrown at it.
However, there may be some fringe cases where this breaks down. If you discover such a case, please create a Bug Report and we'll see if we can correct it. Unfortunately, there may be cases that can't be solved.
- Copy the
fm-mime-typesscript to your solution.
It's that simple.
There are 2 fmp12 files provided here
fm-mime-types.fmp12 file contains the script that you need to copy over.
fm-mime-types-tests.fmp12 file contains our test suite to confirm that the script behaves as intended.
If you open the
fm-mime-types file, you can drag a file onto a container field or enter a filename manually and get the MIME-type by pressing the
Get MIME-type button.
The parameters below can be used for the script. Each parameter has to be followed by a carriage return (¶). The table below will state it's position in the parameters list.
||This is a full filename of file you are trying to get a MIME-type of e.g.
||FileMaker 15 or less ONLY Insert From URL requires a field in FM < 16. Give a field on the current context an object name. This script is smart enough to set the field and then clear it out once it's done with it. Tip: Use a global field|
||FileMaker 15 or less ONLY Repitition number of Object Name value above. This parameter defaults to 1 so can be ignored if not required.|
Here are 2 examples of what you'd pass the
FileMaker <= 15
List ( "image.png" ; "fm-mime-type-object" ; 1 )
fm-mime-type-object is the object name of a field on the current layout.
FileMaker >= 16
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature)
- Commit your Changes (
git commit -m 'Add some AmazingFeature)
- Push to the Branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
Distributed under the MIT License. See
LICENSE for more information.
Project Link: fm-mime-types
fmapi Product Suite
When FileMaker 16 introduced cURL with the Insert from URL script step. Use cases for FileMaker Pro increased dramatically in relation to REST APIs.
It allowed developers to finally communicate with other web services and APIs without the need for 3rd party plugins. Integration with Couriers, Payment Gateways & Social Media Sites all became within touching distance.
However, without prior knowledge of cURL, HTTP Request Methods, HTTP Headers, JSON, OAuth Authentication, API Keys, API documentation etc, it can be extremely difficult to get started for the novice user or even the most proficient FileMaker developer.
And with that comes our goal, to simplify communications between your FileMaker App and the vast amount of Web Services available, no matter your ability level.
Read more over at What is fmapi?
A collection of FileMaker apps that communicate directly with popular 3rd party REST APIs.
- fmapi-vies-vat - Integrate the EU Commissions Vies VAT API directly into you FileMaker App allowing you to validate EU VAT Numbers.