Data Types

UploadJsParams

The optional 2nd parameter given to the upload.uploadFile(file, params) method from the Upload JavaScript SDK.

Structure

Example

{
"metadata": {
"myCustomField1": true,
"myCustomField2": {
"hello": "world"
},
"anotherCustomField": 42
},
"onBegin": Function,
"onProgress": Function,
"path": {
"fileName": "image.jpg",
"fileNameFallback": "image.jpg",
"fileNameVariablesEnabled": true,
"folderPath": "/uploads",
"folderPathVariablesEnabled": true
},
"tags": [
"example_tag"
]
}

Properties

metadata

Arbitrary JSON to store against the uploaded file as metadata.

You can retrieve this later via a GetFileDetails request.

Type: FileMetadata

Required: No

onBegin

Callback taking a single parameter: an object of type UploadJsBeginEvent.

Fired once the upload starts.

Type: Function

Required: No

onProgress

Callback taking a single parameter: an object of type UploadJsProgressEvent.

Fired multiple a times a second (regardless of network-level activity) to yield progress values that are smoothed using an exponential moving average (EMA).

Type: Function

Required: No

path

The path to upload the file to.

Type: FilePathDefinition

Required: No

tags

The tags you specify here determine which rules will be executed for the file upload.

You create rules in the Upload Dashboard, and choose which tags trigger each rule.

Rules include: max file size checks, traffic limit checks, rate limit checks, etc.

Example: ["example_tag"]

Type: String[]

Required: No

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: