Upload Media

wordpress.upload_media
ActionBusiness appsconnection required

Calls the WordPress API with the connection's credentials.

Upload a file to the media library and return its attachment id, ready to use as a post's featured image.

Connection

Required
Yes — the node will not save without one
Auth type
Username & password
Providers
WordPress
Secret shape
{"username": "…", "password": "… the application password …"}
Config it needs
site_url
Resolved by
config.connection_id, else node.connection_id

Configuration

8 fields, 2 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
filename
File name WordPress stores the upload under, including its extension.
stringYes——cover.png
file_content
The file itself, base64-encoded — usually wired from an upstream node's file_content with {{ $json.file_content }}.
stringYes——iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
content_encoding
How file_content is encoded. Binary files must be base64.
stringNobase64one of "base64", "text"—
content_type
MIME type to declare for the upload. Guessed from the filename when empty.
stringNo——image/png
title
Title stored on the attachment.
stringNo———
alt_text
Alternative text for screen readers and SEO.
stringNo———
caption
Caption shown under the file.
stringNo———
post
Id of the post or page to attach the file to; 0 leaves it unattached.
numberNo—≥ 0—

Example configuration

Every value below is the contract’s own example or default — nothing invented.

{
  "content_encoding": "base64",
  "content_type": "image/png",
  "file_content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
  "filename": "cover.png"
}

Output

One shape.

result

FieldTypeExample
id
Attachment id — pass this as featured_media on a post.
number—
source_url
Direct URL of the uploaded file.
string—
link
Attachment page URL.
string—
mime_type
MIME type WordPress detected for the file.
string—
media_type
Coarse type: image, video, audio, text or application.
string—
alt_text
Alternative text stored on the attachment.
string—
title.rendered
Attachment title as HTML.
string—
{
  "alt_text": "",
  "id": 0,
  "link": "",
  "media_type": "",
  "mime_type": "",
  "source_url": "",
  "title": {
    "rendered": ""
  }
}

Notes

  • POST /wp/v2/media sends the file as the raw request body with a Content-Disposition filename — there is no multipart form.
  • Title, alt text, caption and post cannot ride along with a binary body, so they are applied with a follow-up POST /wp/v2/media/<id>.
  • The upload is capped by MANTLE_BINARY_MAX_BYTES, and the site's own upload_max_filesize still applies.

See Upload Media run in a workflow.

In a technical demo we add the WordPress connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.