« FileMaker License Pri… | Home | Neues MBS Plugin 14.0… »

Identify data content

We got various cases where it would be useful to have a way to check the content of a file in FileMaker. Whether the file comes as hex or base64 encoded string, a container value or a file on disk. Why would be need this? Well, let's think about a few cases:

  • You got a file without file extension and you need to know what it is.
  • You got a JPEG, which actually is a PNG or HEIF image.
  • Some user wanted to edit an image before uploading. They dropped it into a word document and later renamed it to have the extension to be imported.
  • You like to check if an attachment is an executable as you like to prevent passing on malware.

To solve these problems, we got a few things in the past. Like we could try to load a picture in GraphicsMagick to see if it would load and thus likely be a real image. Or ask FileMaker to import a file and see if it passes. But to help you, we got three new functions:

Whether you have a file to import, a container value in a field or from a function or some text encoded data from a web service, you can use one of these functions to look into the data. They will return one of the following texts:

PDFPDF document.
JPEGJPEG image.
GIFGIF image.
BMPWindows BMP image
WEBPWebP image.
PNGPNG image.
TIFFTIFF image.
GIFGIF image.
SVGSVG image.
ZIPZIP file, possible Office file
HEIFHEIF image file.
FMPFileMaker database.
EXEWindows executable
MachOmacOS executable
ELFLinux executable

You may combine them with other functions. e.g. if Container.IdentifyData returns "HEIF" for an image and you need a PNG, you would run it through Container.ReadImage to compare. Same for sending email attachments, where you could run the function and reject the attachment if it is an EXE, ELF or MachO file type.

Please note that docx and xlsx files from Word and Excel are internally zip files, so they get reported as zip file.

Please try it and let us know whether they work as expected.

Claris FileMaker Plugin
15 01 24 - 10:56