s3Upload

Uploads a local file to an S3 (or S3-compatible) bucket. The MIME type is auto-detected from the object key extension.

s3Upload(bucket, object, source [, acl, location, accessKeyId, secretKey, host]) → returns void

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

bucket string
Required

The name of the S3 bucket to upload to.

object string
Required

The object key to write.

source string
Required

Path of the local file to upload.

acl string

Object ACL to apply (accepted for compatibility; not enforced).

location string

Bucket location/region (accepted for compatibility).

accessKeyId string

Inline AWS access key id. Overrides credentials from Application.cfc and environment variables.

secretKey string

Inline AWS secret access key.

host string

Inline endpoint URL for S3-compatible providers (e.g. Cloudflare R2, MinIO).

Examples
Sample code invoking the s3Upload function

Reads the local file and stores it in the bucket.

s3Upload("my-bucket", "uploads/report.pdf", expandPath("./report.pdf"));

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub