Upload media
fabrement-upload-mediaUpload one file into the media library from EXACTLY ONE source — sourceUrl (preferred), filePath (on the WordPress machine) or base64 (≤512 KB) — and get {id, url, …} for a block's media attribute. altText is REQUIRED for images. list-media first: it may already exist. Rules: get-skill-doc {id:"site-assets-contract"} — read it before the first call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Optional media library title. | |
| base64 | No | File bytes as base64 (a "data:…;base64," prefix is accepted and stripped). Requires filename. Max 512 KB decoded. Last resort — prefer sourceUrl. | |
| altText | No | REQUIRED for images: what the image shows, for screen readers and SEO. Ignored for non-images. | |
| filePath | No | Absolute path to a file on the WordPress host. One source only. | |
| filename | No | Filename to store it under, e.g. "hero-bg.webp". Defaults to the source filename; REQUIRED with base64 (it carries the extension). | |
| sourceUrl | No | Remote http(s) URL to download into the library. One source only. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | With `url`, the {id, url} pair an image attribute stores; alone, the siteIcon update-site-settings takes. | |
| url | Yes | ||
| width | No | Null for documents, AV and usually SVG. | |
| height | No | ||
| altText | Yes | ||
| filename | Yes | After sanitising and de-duplicating — need not match what was sent. | |
| mimeType | Yes | Detected from the real bytes, not the filename. |