Artboard

Webhook File Uploads

How to upload files to FileMaker Server using OttoFMS webhooks with multipart form-data.

Introduction

OttoFMS supports file uploads via webhooks using multipart form-data. This is useful when you need to receive files from third party services or web forms and make them available to your FileMaker scripts. Using the file receiver endpoint is more efficient than embedding file data in Data API requests.

How it works

OttoFMS provides a separate file receiver endpoint that accepts multipart form-data uploads:

POST https://<server>/otto/filereceiver/{database}/{channel}

When a file is uploaded, OttoFMS:

  1. Saves the file to FileMaker Server's Documents folder at Documents/otto/{uuid}/
  2. Preserves the original filename
  3. Includes any text form fields in the webhook payload
  4. Calls the OttoReceiver script with the file information in the payload

Enabling file uploads

When registering a webhook in the OttoFMS console, enable the File Receiver option. This sets useFileReceiver: true on the webhook and changes the webhook URL from:

/otto/receiver/{database}/{channel}

to:

/otto/filereceiver/{database}/{channel}

Sending files

Files are sent as multipart form-data. Here is an example using curl:

curl -X POST \
  https://your.server.host/otto/filereceiver/Database.fmp12/my-channel \
  -H "Authorization: Bearer dk_your_api_key" \
  -F "file=@/path/to/document.pdf" \
  -F "description=Monthly report"

You can also send files using tools like Postman by setting the request body type to "form-data" and adding file fields.

File upload webhooks use the same authentication methods as regular webhooks: Bearer token in the Authorization header, apiKey query parameter, or path parameter. See Webhook Authentication for details.

Accessing files in OttoReceiver

The webhook payload includes an uploaded_files array with information about each uploaded file. Each entry contains the following properties:

PropertyDescription
fieldnameThe form field name used when uploading
originalnameThe original filename of the uploaded file
mimetypeThe MIME type of the file (e.g. application/pdf)
sizeThe file size in bytes
destinationThe directory where the file was saved
filenameThe saved filename on disk
pathThe full filesystem path to the file

Here is an example payload:

{
  "description": "Monthly report",
  "uploaded_files": [
    {
      "fieldname": "file",
      "originalname": "document.pdf",
      "mimetype": "application/pdf",
      "size": 102400,
      "destination": "/path/to/Documents/otto/abc-123/",
      "filename": "document.pdf",
      "path": "/path/to/Documents/otto/abc-123/document.pdf"
    }
  ]
}

Use the path field in your OttoReceiver script to retrieve the file from the filesystem using FileMaker's Insert File or Insert PDF script steps.

File cleanup

Uploaded files are automatically cleaned up after 24 hours. Make sure to process files promptly or copy them to a permanent location within your FileMaker solution.

On this page