Form Data

Whenever possible, we recommend using the Tus endpoint instead.

Endpoint

The form-data endpoint can be obtained through the pluginApi:

pluginApi.media.formDataUploadUrl

Headers

In addition to the headers described in Frontend, we also require the following headers to be set:

upload-length

The size of the uploaded media/file.

Here's an example of including these data using Uppy:

new Uppy().use(XHR, {
  endpoint: pluginApi.media.formDataUploadUrl,
  headers: (file) => ({
    "csrf-token": appData.getCSRFToken(),
    "organization-id": pluginApi.pluginContext.organizationId,
    ...(file.size
      ? {
          "upload-length": file.size.toString(),
        }
      : {}),
  }),
})

Last updated