Automatically upload files from a form’s File Upload field to a Cloudflare R2 bucket — S3-compatible object storage without egress fees. Cloudflare R2 requires Contactum Pro with the module enabled.
Requirements #
- Contactum Pro, with the Cloudflare R2 module active (Contactum → Modules)
- An active Cloudflare account with an R2 bucket already created
- An R2 API Token with Object Read & Write permission
1. Get Your R2 Credentials #
- In your Cloudflare dashboard, note your Account ID (shown on the R2 overview page).
- Create an R2 API Token with Object Read & Write permission, and copy the resulting Access Key ID and Secret Access Key.
- Note the name of the bucket you want to upload into.
- If you want uploaded files to be publicly linkable, note your bucket’s r2.dev Public Development URL or connected custom domain — R2 buckets are private by default.
2. Connect Cloudflare R2 in Contactum #
- Go to Contactum → Settings → Integrations → Cloudflare R2.
- Fill in:
- Account ID
- Access Key ID
- Secret Access Key
- Bucket Name
- Public Base URL (optional) — your r2.dev URL or custom domain, if you want a public link stored for each upload. Leave blank to skip.
- Path Prefix (optional) — a leading folder applied to every upload, e.g.
contactum/uploads/(default). Include the trailing slash.
- Click Save & Test Connection.
Contactum writes and immediately deletes a tiny test object in your bucket to confirm the credentials work. On success you’ll see a confirmation and the status badge turns green. Unlike some integrations, these fields stay visible and editable even after a successful connection, so you can update any value without needing to “disconnect” first.
To disconnect, click Disconnect Cloudflare R2 — this clears the stored credentials and stops all uploads until reconnected.
3. Enable Cloudflare R2 on a Specific Form #
- Open the form in the builder.
- Go to Form Settings → Integrations.
- Toggle Enable R2 for this form on, then click Configure.
4. Configure Upload Settings #
| Field | Description |
|---|---|
| Folder Prefix | A folder path appended after the global Path Prefix, e.g. form-7/ (leave blank to use just the global default) |
| Delete local copy after upload | Removes the file from your WordPress server once it’s safely uploaded to R2 |
No field mapping — this integration handles files only.
5. How It Works #
Uploads happen as soon as a visitor selects a file in a File Upload field, not when the form is finally submitted:
- Contactum checks the global connection is active and this form has R2 enabled.
- The destination key is built from the global Path Prefix + this form’s Folder Prefix + the original filename.
- The file is uploaded to your R2 bucket.
- On success, Contactum always stores the object’s storage key on the file’s WordPress attachment. It additionally stores a public link only if you set a Public Base URL in the global settings — without one, the file stays private in your bucket with no public link recorded.
- If Delete local copy after upload is enabled, the file is removed from your server after a successful upload.
A failed upload does not block form submission, and is recorded in Contactum’s API Log for review.
Unlike Amazon S3, R2 has no per-file public/private toggle. Visibility is controlled entirely at the bucket/domain level — either your bucket has a public URL connected (the Public Base URL field) and every uploaded file is reachable through it, or it doesn’t and nothing is.
Troubleshooting #
“Your settings could not be verified” #
- Reconfirm the Account ID, Access Key ID, Secret Access Key, and Bucket Name are all correct, and that the API Token has Object Read & Write permission.
Files aren’t uploading #
- Confirm the form has Enable R2 for this form toggled on and saved.
- Confirm the global connection still shows verified.
- Check the API Log (Contactum → Tools → API Log, if available) for a logged failure and its error message.
Uploaded files have no public link #
- This is expected if you left Public Base URL blank. Set it to your bucket’s r2.dev URL or connected custom domain if you want files to be publicly linkable.
I enabled “Delete local copy” and now a file is missing #
- If an upload to R2 fails, don’t rely on the local copy having been deleted — but a successful upload followed by deletion is permanent. If this happens repeatedly, disable Delete local copy after upload until you’ve confirmed uploads are reliably succeeding.
Notes #
- Requires Contactum Pro with the Cloudflare R2 module active — not available in the free plugin.
- Auth method: static Access Key ID + Secret Access Key (R2 API Token) — S3-compatible signing, not OAuth.
- Credentials storage: all fields are stored in
wp_optionsunder the keycontactum_r2. - A failed submission never blocks the form — the visitor’s experience is unaffected by an R2 outage or misconfiguration.