Upload a local file to a B2 bucket
b2_upload_fileUploads a local file to a B2 bucket, returning its stored file id, name, size, and type. The path must be inside B2_UPLOAD_ROOT; duplicate names create new versions.
Instructions
Uploads a file from the local filesystem into a bucket and returns the stored file id, name, size, and type. The local path must sit inside the directory named by B2_UPLOAD_ROOT; uploads are refused otherwise. Uploading an existing name adds a new version rather than replacing the old one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fileName | No | Name to store in the bucket. Defaults to the local file name. | |
| localPath | Yes | Path to the local file. Must be inside B2_UPLOAD_ROOT. | |
| bucketName | Yes | Name of the destination bucket. | |
| contentType | No | MIME type. Omit to let B2 detect it. |